I'm trying to set a specific color for each cell in my DataGrid
that have a specific value. I saw a lot on the net, but I doesn't found one that approach my situation.
Essentially I've this DataGrid
structure:
<DataGrid ItemsSource="{Binding MatchService.Matches}" AutoGenerateColumns="False"
CanUserAddRows="false" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="{DynamicResource championship}" Binding="{Binding Competition}"/>
<DataGridTextColumn Header="1" Binding="{Binding HomeWin}"/>
<DataGridTextColumn Header="X" Binding="{Binding Draw}"/>
</DataGrid.Columns>
so I need to use a pure xaml solution, in particular a generic style that handle all the cell value. For example, if HomeWin
cell have the value <50
the cell background will be red
also if the cell value is >60
the background will be green.
How can I create a default style and bind it for each DataGridTextColumn
without wrote converter or such?
Thanks.