Setting WPF datagrid selected row color at application level

Updated on     Kisan Patel

Problem:

How to Set WPF datagrid selected row color at application level?

Solution:

To set the Background for a selected DataGridRow/DataGridCell at application level you can add the following Style to App.xaml

<Application ...>
     <Application.Resources>
         <Style TargetType="DataGridCell">
            <Style.Triggers>
                 <Trigger Property="IsSelected" Value="True">
                     <Setter Property="Background" Value="LightBlue"/>
                 </Trigger>
            </Style.Triggers>
         </Style>
     </Application.Resources>
</Application>

WPF