Infragistics XamDataGrid AllowEdit属性绑定不起作用

时间:2012-01-26 15:01:30

标签: wpf infragistics xamdatagrid

在我的XAML中,我试图将我的XamDataGrid的AllowEdit绑定到属性

<igDP:XamDataGrid.FieldSettings>
  <igDP:FieldSettings AllowEdit="{Binding Path=DataItem.Approved}"/>
</igDP:XamDataGrid.FieldSettings>

但它不起作用。所有其他绑定工作正常。有任何想法吗?我是WPF的新手,所以任何帮助都会受到赞赏

4 个答案:

答案 0 :(得分:4)

我使用一种风格来解决这个限制,例如:

<igWPF:Field Name="SomeValue">
    <igWPF:Field.Settings>
    <igWPF:FieldSettings EditorType="{x:Type igWPF:XamNumericEditor}">
        <igWPF:FieldSettings.EditorStyle>
        <Style TargetType="{x:Type igWPF:XamNumericEditor}">
            <Setter Property="IsReadOnly" Value="{Binding DataItem.IsReadOnly}" />
        </Style>
        </igWPF:FieldSettings.EditorStyle>
    </igWPF:FieldSettings>
    </igWPF:Field.Settings>
</igWPF:Field>

答案 1 :(得分:1)

显然你(仍然......)无法绑定此属性:http://www.infragistics.com/community/forums/t/10907.aspx 叹息...

答案 2 :(得分:1)

我通常使用一种风格来实现这一点,就像@ larsmona上面的回答一样。最近我学会了使用CellBindings和FieldBindings来实现这一目标。

https://www.infragistics.com/community/blogs/b/blagunas/posts/feature-spotlight-new-fetaures-in-the-infragistics-wpf-xamdatagrid

https://www.infragistics.com/help/wpf/xamdatagrid-binding-cell-settings-data-item-properties

http://help.infragistics.com/Help/Doc/WPF/2014.2/CLR4.0/html/xamDataPresenter_Binding_Cell_Settings_Data_Item_Properties.html

<igDP:Field Name="SomeName" Row="0" Column="1" Label="SomeLabel" AllowEdit="True">
  <igDP:Field.CellBindings>
   <igDP:CellBinding Target="Editor" Property="IsReadOnly" Binding="{Binding DataItem.SomeProperty}"></igDP:CellBinding>
  </igDP:Field.CellBindings>
</igDP:Field>

答案 3 :(得分:-1)

也许你对ObservableCollection有约束力?如果是这种情况,则无法编辑您的项目。您可以尝试绑定到BindingList