DataGrid Problem with Row Validation and Editing

Feb 6, 2009 at 9:37 PM
I have a couple issues I haven't been able to figure out using a DataGrid.  I have a DataGrid that is bound using ItemsSource which is set to an ObservableCollection.  I then added a RowValidationRule.  When a given row fails validation, it then prevents you from editing any row but that row.  Is there a way to disable that behavior and allow me to edit other rows?

I am removing rows by removing an entry from the ObservableCollection that the DataGrid is bound to.  If that row has failed validation, and then I delete it, I cannot edit anything else in my DataGrid.  Is this a bug, or am I missing a step here?

Feb 11, 2009 at 6:26 AM
The reason the DataGrid does not allow editing of other rows is b/c of the side effects it has on editing transactions in general.  One of the main scenarios that we want to provide with validation is that when you do get into an error state, you have to ability to cancel out of it.  If you were allowed to edit additional rows, this ability will be forfeited.  Unfortunately, there isn't a way to customize this behavior currently and you will have to do your own cusotm validation to get this behavior.

Jul 25, 2009 at 3:17 PM

This seems to be the same issue as in:
Are there any plans to change this behavior?
Is there an example of how to do custom validation?


Jul 28, 2009 at 9:10 AM


Problem is with one of LocalVaribale in Datagrid  "_HasCellValidation".If we can reset the "HasCellValidationError" to false.We can able to edit the datagrid on reseting data in datagrid or removing an item in Datagrid.

I used reflection to reset the hascellvalidation.I know this is not right approach,but in order solve my problem,i used reflection approach.


With Regards,


Jul 30, 2009 at 5:29 PM

This  situation arises for you as you are using IDataErrorInfo based validations and cannot cancel the edit.

Micsoroft has said that with V2 (VS20100)  this situation shoudl be alleviated as they are workign on changing the event firing sequences.