GridControl 行背景颜色设置

Posted wxstar8

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GridControl 行背景颜色设置相关的知识,希望对你有一定的参考价值。

                            <dxg:GridControl.View>
                                <dxg:TableView    AllowPerPixelScrolling="True"  Name="tvSAP" AllowEditing="False" ShowTotalSummary="False" ShowGroupPanel="False"  UseLightweightTemplates="None">
                                    <dxg:TableView.RowStyle>
                                        <Style TargetType="dxg:GridRowContent" BasedOn="StaticResource dxgt:GridRowThemeKey ResourceKey=RowStyle">
                                            <Setter Property="Background" Value="Binding Row.ComponentCode, Converter=StaticResource NewSAPCodeConvert"/>
                                        </Style>
                                    </dxg:TableView.RowStyle>
                                </dxg:TableView>
                            </dxg:GridControl.View>

之前在网上找了代码,没有这句 UseLightweightTemplates="None",造成在编译的时候老通不过,最后在论坛中的到大神的指点,才最终解决这个问题,记录一下。

Value="Binding Row.ComponentCode, Converter=StaticResource NewSAPCodeConvert这句,其中Row.ComponentCode,是绑定这列的字段,根据这一列的数据通过转换器完成行颜色的改变。


 

实现效果:


以上是关于GridControl 行背景颜色设置的主要内容,如果未能解决你的问题,请参考以下文章