(There are similar questions around this topic, but none really match the way I've gone about it.)
I would like to change the colour of each of my DataGrid's cells based on their value inside them (an integer, from 0 to 3). Currently, I am able to change a cell's colour by mousing over, using this:
<DataGrid Name="mapDisplay" ItemsSource="{Binding}" Margin="0,59,10,0">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
</DataGrid>
This code changes any moused over cell to 'Red'. But how could I change the colour according to its value?