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