I came across a very strange behavior with a DataGrid. I have a trigger on a DataGridRow
<Style TargetType="{x:Type DataGridRow}"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="{StaticResource SelectionBackgroundBrush}"/> <Setter Property="Foreground" Value="White"/> </Trigger> </Style.Triggers> </Style>
Initially, when a row is selected, I get behavior from the above trigger. However, after choosing if the DataGrid loses focus (for example, I click on another button on the window), the Foreground property loses its value, but the background remains the same as indicated in the trigger. Has anyone ever come across this behavior, or there are some problems with my code above (or elsewhere in my application, for that matter). Any workarounds for the above problem?
source share