首页 文章

XPF.Grid.GridControl访问行数据

提问于
浏览
1

我使用XPF.Grid.GridControl,绑定到IEnumerable数据gridControl.DataSource = dataSource;

我需要突出显示行依赖于单元格值 . 单元格包含颜色名称 . 好的,我使用:

<dxg:GridControl.Resources>
          <Style x:Key="ColorRowStyle" TargetType="{x:Type dxg:GridRowContent}">
                                <Setter Property="Background" Value="{Binding Converter={l:IntoToColorConverter}}" />
          </Style>
   </dxg:GridControl.Resources>

在我的IntoToColorConverter我需要访问数据绑定到行,但在公共对象转换(对象值,System.Type targetType,对象参数,System.Globalization.CultureInfo文化)我有

value is RowData
       value.DataContext - RowTypeDescriptor

我该如何使用此对象访问行数据?

1 回答

  • 0

    您可以尝试为Datagrid.Resources中的单元格定义通用样式,例如

    <Style TargetType="{x:Type DataGridCell}">
        <Setter Property="Background" Value="{Binding RowColor, Converter={MyColorConverter}}" />    
    </Style>
    

相关问题