应用场景:当我们使用devexpress gridcontrol wpf控件时。可要会要根据这一行要显示的值来设置相应的颜色
可以通过下面方法来实现
一、先定义一个style
<local:Conv x:Key="c"/>
<Style x:Key="optimizedRowStyle" TargetType="{ x:Type dxg:RowControl}">
<Setter Property="Background" Value="{Binding Row.Column2, Converter={StaticResource c}}"/>
</Style>
x:Type dxg:RowControl 说明这个style是针对行的
Binding Row.Column2 表示改背景颜色会根据第二列的值来动态设置其颜色
二、把style应用到控件上
<dxg:GridControl ItemsSource="{StaticResource Data}" VerticalAlignment="Stretch" Heigh