Cross-property validation in WPF MvvM

In a previous post I have described hot to utilize a INotifyDataErrorInfo interface. Today I will show you my solution for automated cross-property validation integrated with the ModelValidation base class from previous post. First I add a custom CrossValidationAttribute and later on a virtual method which will be called from above CrossValidationAttribute for each property mar…

By Mirek on (tags: CustomValidationAttribute, mvvm, validation, WPF, categories: code)

Utilizing INotifyDataErrorInfo in WPF MvvM app

Today I will show you how I utilize the INotifyDataErrorInfo interface to accomplish validation mechanisms in WPF application.   A time ago I have described how to validate model in WPF application with use of IDataErrorInfo interface. Now in WPF 4.5 we have another possibility which is the INotifyDataErrorInfo interface. The MSDN documentation is here a little scarce, but…

By Mirek on (tags: INotifyDataErrorInfo, mvvm, validation, WPF, categories: code)

Simple validation in WPF MvvM Part 2

In a previous post I showed you how to use IDataErrorInfo interface to implement simple validation mechanism in WPF MvvM application. In this post we will try to extend and customize this approach a little. It would be nice I the fields of the form be validated on Save button click. So the user will not see error messages when he opens the for for the first time To achieve that…

By Mirek on (tags: IDataErrorInfo, mvvm, validation, WPF, categories: code)

Simple validation in WPF MvvM using IDataErrorInfo

In this post I will try to demonstrate the simplest validation approach for Windows Presentation Foundation application designed in Model View View-Model pattern. We will be using data binding and IDataErrorInfo implementation. Ok. Let’s assume we have simple data model ProductModel which looks like this So we have Name, Price and Amount text boxes, which we want to bind to the…

By Mirek on (tags: IDataErrorInfo, mvvm, validation, WPF, categories: code)