此触发器适用于EnableRowVirtualization="True"
<DataGrid Name="dg" Style="{DynamicResource estiloDG}" MinRowHeight="40" GridLinesVisibility="None"
HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray"
BorderBrush="Gray" BorderThickness="1" Foreground="#424242"
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
ItemsSource="{Binding ElementName=Me, Path=ItemsSource, Mode=OneWay}" x:FieldModifier="Private"
EnableRowVirtualization="True"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="True" CanUserSortColumns="True">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="White" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFD0E8D0" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Resources>
<Style x:Key="estiloDG" TargetType="{x:Type DataGrid}">
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="Background" Value="White" />
<Setter Property="MinHeight" Value="30" />
<Setter Property="ColumnHeaderHeight" Value="30" />
<Setter Property="HeadersVisibility" Value="All" />
<Setter Property="RowBackground" Value="{StaticResource RowBackgroundBrush}" />
<Setter Property="AlternationCount" Value="2" />
<Setter Property="HorizontalGridLinesBrush" Value="{StaticResource DataGridHorizontalLinesBrush}" />
<Setter Property="VerticalGridLinesBrush" Value="{StaticResource DataGridHorizontalLinesBrush}" />
<Setter Property="CellStyle" Value="{StaticResource DataGridCellStyle}" />
<Setter Property="RowValidationErrorTemplate" Value="{StaticResource ErrorTemplate2}" />
<Setter Property="ColumnHeaderStyle" Value="{StaticResource DatagridColumnHeaderCustomTemplateStyle}" />
</Style>
</DataGrid.Resources>