As mentioned in the introduction to this chapter, we have a lot of validation options to choose from in XAML-based technologies. Let's now take a look at the options that are best suited for use in MVVM applications.
This is the simplest and most commonly used validation technique. A WPF binding can be associated with a number of custom validation rules, each subclassed from
ValidationRule. There are only two validation rules provided as part of the library:
We can define additional custom validation rules by inheriting from
ValidationRule. We can add them to the
ValidationRules collection for a binding, as follows: ...