Roberto Salemi

Roberto Salemi

  • NA
  • 146
  • 141.4k

[WPF] DataTriggers: remove property set by onother triggers

Mar 9 2015 6:30 AM
Hi,


I'm using DataTrigger for color my cells:


<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsDeletedItem}" Value="True">
<Setter Property="Background" Value="Yellow" />
<Setter Property="Foreground" Value="Blue" />
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
<DataTrigger Binding="{Binding Active, Converter={StaticResource YerOrNotToTrueOrFalse}}" Value="True" >
<Setter Property="Background" Value="Blue" />
</DataTrigger>
<DataTrigger Binding="{Binding Active, Converter={StaticResource YerOrNotToTrueOrFalse}}" Value="False" >
<Setter Property="Background" Value="Gray" />
</DataTrigger>
</Style.Triggers>
</Style>
It's work fine, but when I change the property IsDeletedItem, the foreground changes, while the background remains the one set by the property "Active".


So, I think that I must removed property set by other DataTrigger, right?


How?


Thanks



Answers (1)