WPF datagrid 实现隔行变色
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<DataGrid AlternationCount= "2" >
<DataGrid.RowStyle>
<Style TargetType= "{x:Type DataGridRow}" >
<Style.Triggers>
<Trigger Property= "ItemsControl.AlternationIndex"
Value= "0" >
<Setter Property= "Background" Value= "#FFE4DDB3" />
</Trigger>
<Trigger Property= "ItemsControl.AlternationIndex"
Value= "1" >
<Setter Property= "Background" Value= "#FFF2F2F2" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid> |