How do I set the background colour of individual grid items based on a property of the individual item? I have the following code:
<PivotItem x:Uid="PivotBlocks" Margin="10, 10, 10, 10" Header="blockx" DataContext="{Binding Blocks}" d:DataContext="{Binding , Source={d:DesignData Source=/DataModel/SampleData.json, Type=data:DataSource}}">
<GridView ItemsSource="{Binding Formations}" IsItemClickEnabled="True" ItemClick="Point_ItemClick" Loaded="PivotBlocks_Loaded" ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView.ItemTemplate>
<DataTemplate>
<Grid Width="80" Height="80" Margin="0,0,10,10" Background="{StaticResource PhoneAccentBrush}">
<StackPanel VerticalAlignment="Bottom">
<TextBlock Text="{Binding Shorthand}" Padding="5, 0, 0, 5" Style="{StaticResource SubheaderTextBlockStyle}" />
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</PivotItem>
Each Formation (item) has a HasBeenSelected
property of type Bool
that I want to use to set the colour, so grey if true, otherwise the users accent colour.