【问题标题】:DevExpress GridControl: bind background color of the rows to a Model's propertyDevExpress GridControl:将行的背景颜色绑定到模型的属性
【发布时间】:2021-03-11 02:42:28
【问题描述】:

我正在测试 DevX GridControl(20.1 版)。我需要将每一行的背景颜色绑定到模型中的一个字段。 我尝试了各种方法,但都以使用与所选行关联的背景更改网格所有行的背景结束。 使用旧版本,我可以通过以下方式进行管理:

<dxg:TableView AllowResizing="True" AutoWidth="True" ShowTotalSummary="True" >

   <dxg:TableView.RowStyle>
      <Style TargetType="{x:Type dxg:GridRowContent}">
         <Setter Property="Background" Value="{Binding DataContext.DataModel.ColoreSfondo, ElementName=CDList}" />
      </Style>
   </dxg:TableView.RowStyle>
</dxg:TableView>

我也尝试了条件格式,但我不知道如何将背景绑定到我的模型。

【问题讨论】:

  • 你能提供CDList的定义吗?

标签: wpf binding devexpress row gridcontrol


【解决方案1】:

问题解决了!

只需用这个替换 Setter 行:

<Setter Property="Background" Value="{Binding Row.ColoreSfondo}" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-15
    相关资源
    最近更新 更多