Hi,
I have a WPF app that consists of a view containing a grid filled from the database with custom data template. in this grid I have several textboxes which i need to validate. Here I use IDataErrorInfo.
The actual validation(class implementing IDataErrorInfo) is the viewmodel.
In my view i have the following
So every time validation fails, the Validation_Error is executed and I get a ValidationError object stating what went wrong. Thats good, problem is I want to keep track of the amount of errors on the view so I can set the value of a property on the view, IsValid determining if the view has any errors. Problem is that this method fires on errors, not when a property is valid, so by using this approach I can detect when an error occurs, but I can not see when its rectified. What actually happens is, that I enter an invalid value in a field, the method fires stating error - now i enter a valid value in another field, method fires stating no error, but the other field still isnt valid but my IsValid is now true...What is the correct way of keeping track on validity. I need this because I need to disable/enable a save button which is on another view than the one being validated.Code:<TextBox Validation.Error="Validation_Error" Text="{Binding UpdateSourceTrigger=LostFocus,Path=DegradationPoint,ValidatesOnDataErrors=True,NotifyOnValidationError=True}"/>


Reply With Quote