WPF DevExpress中GridControl动态修改行背景颜色 - 借用的


<dxg:TableView.RowStyle>

    <Style TargetType="dxg:GridRowContent" BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}">

        <Setter Property="Background" Value="{Binding Row.USER_ID, Converter={StaticResource conv}}"/>

    </Style>

</dxg:TableView.RowStyle>

  提示:“GridRowContent”TargetType 与元素“RowControl”的类型不匹配。

在dxg:TableView 中设置UseLightweightTemplates 为None 就可以了。

<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>

  

  1. <dxg:GridControl.View>
  2.  
    <dxg:TableView AllowPerPixelScrolling= "True" Name= "tvSAP" AllowEditing= "False" ShowTotalSummary= "False" ShowGroupPanel= "False" UseLightweightTemplates= "None">
  3.  
    <dxg:TableView.RowStyle>
  4.  
    <Style TargetType= "dxg:GridRowContent" BasedOn= "{StaticResource {dxgt:GridRowThemeKey ResourceKey=RowStyle}}">
  5.  
    <Setter Property= "Background" Value= "{Binding Row.ComponentCode, Converter={StaticResource NewSAPCodeConvert}}"/>
  6.  
    </Style>
  7.  
    </dxg:TableView.RowStyle>
  8.  
    </dxg:TableView>
  9.  
    </dxg:GridControl.View


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM