Skip to content

Instantly share code, notes, and snippets.

@dkalamari
Created April 18, 2014 08:02
Show Gist options
  • Save dkalamari/11030646 to your computer and use it in GitHub Desktop.
Save dkalamari/11030646 to your computer and use it in GitHub Desktop.
WPF datagrid row alternate color
<Style TargetType="{x:Type DataGrid}">
<Setter Property="Background" Value="#FFF" />
<Setter Property="AlternationCount" Value="2" />
</Style>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#EFEFEF"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF"></Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightBlue" />
</Trigger>
</Style.Triggers>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment