Feb 9, 2010 at 4:44 PM
Edited Feb 9, 2010 at 5:59 PM
I have managed to come up with a bit of a bodge workaround to solve this problem.
I have written a custom attached property; IsValid, and a custom attached event; ValidityChanged. In the IsValid property change call back I raise the ValidityChanged event. In the XAML I have an event
setter for the DataGridRow style for the ValidityChanged attached event, and a style trigger when Validation.HasError is true sets the IsValid property to false. XAML looks like this:
<!-- DataGridRow Style -->
Self}, Path=(Validation.Errors).ErrorContent}" />
I think this is quite a generic solution i.e. would work in any scenario with ValidationRules, but I think the normal binding validations rules, and NotifyOnValidationError=True will work fine in most cases.