Question

I've got a situation where I have set the DataSource of a XamDataGrid to a list of ViewModels. Thus, my XamDataGrid is expected to have multiple rows. I would like to bind the editablity of a given cell to a property on the cell's viewmodel. My initial idea is just to bind the Field's AllowEdit property to the ViewModel (which would make sense to anyone except Infragistics), but that doesn't work. How can I accomplish this?

I would like to accomplish this through bindings, if at all possible.

Was it helpful?

Solution 2

I'm coming back to this after a while, but I've implemented the solution elsewhere. The great news is that, in Infragistics 2014 and above, you can use a FieldBinding. If that's not available, then look into a binding proxy using a Freezable, as described here.

OTHER TIPS

For cell by cell control over editing edit mode it is necessary to handle the EditModeStarting event and set e.Cancel to true when you don't want to allow editing. If you want to do this through binding only then you could possibly use a behavior and put the logic in the behavior.

Set AllowEdit at the grid level to True

<igDP:FieldSettings AllowEdit="True"/>

And set the attribute Readonly true for the column which does not allow editing

[ReadOnly(true)]
public string Name{ get; set; }

And if you have moved to a 4.0 then "EditableAttribute" can be used

[EditableAttribute(AllowEdit ="False")]
public string Name{ get; set; }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top