WPF DataGrid动态生成列的单元格背景色绑定
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Column.DisplayIndex}" Value="1"> <Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.Text,
Converter={StaticResource cellBackgroundConvert}}"/> </DataTrigger>
上面的是datagrid第一列的单元格背景色根据值改变。