Infragistics XamDataGrid AllowEdit property binding not working

6.6k Views Asked by At

In my XAML I'm trying to bind AllowEdit of my XamDataGrid to a property

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

But it doesn't work. All other bindings work fine. Any ideas? I'm new to WPF so any help would be appreciated

4

There are 4 best solutions below

1
On

I use a style to get around this limitation, e.g.:

<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>
0
On

I usually used a style to achieve this as in @larsmona's answer above. Recently I learned about using CellBindings and FieldBindings to achieve this.

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>
0
On

Apparently you (still.....) cannot bind this property: http://www.infragistics.com/community/forums/t/10907.aspx sigh...

0
On

Perhaps you're binding to ObservableCollection? If that's the case, you can't edit your items. You can try bind to BindingList instead.