MultiConverter的sfDataGrid RowStyling

时间:2018-11-25 12:47:51

标签: data-binding wpfdatagrid syncfusion imultivalueconverter

我有一个行项目的多个属性,具体取决于哪一个,我需要选择一个行样式。 样式选择器不是我可以使用的东西,因为应根据每个依赖属性的属性更改来更新样式。我试图像这样设置网格的行样式:

 <controls:sfDataGrid.RowStyle>
                <MultiBinding Converter="{StaticResource RowBackgroundConverter}">
                    <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}"/>
                    <Binding Path="Property1" UpdateSourceTrigger="PropertyChanged"/>
                    <Binding Path="Property2" UpdateSourceTrigger="PropertyChanged"/>
                </MultiBinding>
            </controls:sfDataGrid.RowStyle>

但是,这不起作用,因为它试图在网格的数据上下文中搜索Property1和Property2(它应该在行项目中搜索)。 我们会这样吗?

  <Binding Path="Data.Property1" UpdateSourceTrigger="PropertyChanged"/>
  <Binding Path="Data.Property2" UpdateSourceTrigger="PropertyChanged"/>

? 如果没有,我该如何连接正确的数据上下文。

致谢

0 个答案:

没有答案