<DataGrid.RowHeaderStyle>
<Style TargetType="DataGridRowHeader">
<Style.Triggers>
<DataTrigger Binding="{Binding Type}" Value="1">
<Setter Property="Background" Value="DeepSkyBlue"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="0">
<Setter Property="Background" Value="White"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowHeaderStyle>
Type为数据表中某一列
注意:TargetType="DataGridRowHeader"
修改的属性是行头的背景颜色,效果如下:
或者:
<DataGrid.ColumnHeaderStyle>
<Style>
<Setter Property="DataGridColumnHeader.Background" Value="DeepSkyBlue"></Setter>
</Style>
</DataGrid.ColumnHeaderStyle>
Property="DataGridColumnHeader.Background" 不指名DataGridColumnHeader会报错
手机扫一扫
移动阅读更方便
你可能感兴趣的文章