Hello, I started with WPF ( XAML ) and I was desperately trying to change the color of a selected line in my DataGrid
. I create a resource in my grid , but I can not use :
<Grid.Resources>
<!-- DataGridCell Style-->
<Style x:Key="MyDataGridCellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Background" Value="White"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>