Posted by: MarkWPF
Databinding, Microsoft Windows, Validation, Windows Computing, WPF, XAML
As I mentioned in a previous post, you can specify validation by creating a Validation class (or classes).
You do this by deriving a new class from the ValidationRule class and overriding the Validate method.
Why would you do this, instead of implementing IDataErrorInfo?
Well, if you wanted to do validation across a number of objects, then this is the way to go.
It also provides a level of separation from your business objects, leaving them to deal with business data and the validation objects to deal with validation.
A downside is that it is not backwardly compatible with WinForms
How do you tell your xaml to use it? By specifying it in the ValidationRules element of your binding – just like IDataErrorInfo.