Reputation: 2799
I have WPF DataGrid. I need custom style for some rows(e.g for rows where 4th cell has negative value). How can I set condition for applying custom style? Is this possible?
Upvotes: 1
Views: 928
Reputation: 22445
Have you tried a rowstyle with a DataTrigger? You will need a Converter to for checking negativ values.
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding AmountProperty4thCell, Converter={StaticResource MyNegativCheckConverter}}" Value="True">
<Setter Property="Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
Upvotes: 3