Take the 2-minute tour ×

I have a DataGrid, where items can be selected. Next to it, there are TextBoxes and other editor controls, which are used to edit the selected item.

I want to have the item in the DataGrid to be updated with the properties that are being edited, even if the currently inserted data is invalid. (User can't save invalid data, can't change selected item during editing and cancellation is working too.)

Can this be done in WPF?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

ValidationRule.ValidationStep gets or sets when the validation rule runs.

Since you want the validation rule to run after the source is updated, you'll want to use ValidationStep.CommittedValue.

See msdn for more details.

share|improve this answer
I found that if you use ValidationStep.CommittedValue or ValidationStep.UpdatedValue, the Validate method will get the BindingExpression as the value, not the input. So you have to get the value from the BindingExpression which will give you the source value, that you have to convert with the BindingExpression.Converter, etc. Not so simple... –  CainKellye Oct 3 '12 at 14:21
@CainKellye, Looks like that issue is addressed here –  vivek maharajh Oct 4 '12 at 18:15
Thanx, but I had to create a more difficult solution, that involves two validationRules: first runs with RawProposedValue and stores the validation result to a dictionary, but returns valid. Second runs with CommittedValue and returns the previously stored validation from the dictionary. This way I don't have to deal with conversions and no problems with ValidateOnTargetUpdated set to true. –  CainKellye Oct 5 '12 at 12:29

Your Answer


