-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Milestone
Description
Hi guys,
I've applied the code below to a DataGrid. My goal is to get the foreground text of a row to show up red if the data trigger is met.
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource MetroDataGridRow}">
<Setter Property="behaviors:DataGridRowDoubleClickBehavior.DoubleClickCommand" Value="{Binding ElementName=EventGrid, Path=DataContext.ModifyEventForm.OpenFormCommand}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsTransferred}" Value="True">
<Setter Property="Foreground" Value="Gray"/>
<Setter Property="FontStyle" Value="Italic"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=OpCode}" Value="999">
<Setter Property="Foreground" Value="DarkRed"/>
<Setter Property="FontWeight" Value="Bold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
However, only the FontStyle
and FontWeights
are affected. I am assuming this is because the Foreground
is set in MA.M's styles via Triggers on things like 'IsSelected'.
Is there a working solution for overriding things like this? I'm no master of style hierarchy in WPF :)