How could I keep text in my row coloured for example white when DataGrid Row is Selected, and also when it is in a Inactive Selection mode (it was selected and now user clicked on another control i.e textbox).
I tried with this ( set Cell Style):
<DataGrid.CellStyle>
<StaticResource ResourceKey="DataGridCentering"/>
</DataGrid.CellStyle>
Where I said in my App.Xaml:
<Style x:Key="DataGridCentering" TargetType="{x:Type DataGridCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
As it is possible to notice, I tried to do it with triggers, i.e when cell is selected colour my text inside cell with white colour etc, but obliviously this is not working
My text in DataGrid when cell/row is selected is still black..