robertino_salemi
09-03-2015, 10:24
Buongiorno,
sto utlizzando i DataTrigger per colorare le mie righe:
<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>
Funziona bene, ma quando cambio la property "IsDeletedItem", il foreground cambia, mentre il background rimane quello settato dalla property "Active".
Credo che quindi dovrei rimuovere il Background settato dalle altre property prima di applicarle uno nuovo, giusto?
Come?
Grazie.
sto utlizzando i DataTrigger per colorare le mie righe:
<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>
Funziona bene, ma quando cambio la property "IsDeletedItem", il foreground cambia, mentre il background rimane quello settato dalla property "Active".
Credo che quindi dovrei rimuovere il Background settato dalle altre property prima di applicarle uno nuovo, giusto?
Come?
Grazie.