Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Validation Framework

Given the following requirements:

  • WPF Application
  • MVVM Pattern
  • Validatable viewmodels
    • with nested (validatable) viewmodels
    • with nested Collections of (validatable) viewmodels
  • WPF Controls which become disabled on validation errors
    • e.g. Binding Views IsEnabled to IsValid-Property in Viewmodels

Is there any built-in or third-party validation framework available for WPF, or do I have to write one on my own? I've given IDataErrorInfo a try, but I failed when it came to validating nested viewmodels or entire collections.

Thanks!

like image 957
Jonas W Avatar asked Jul 18 '13 10:07

Jonas W


Video Answer


1 Answers

If you want a framework with extensive validation support i would say Catel is your best shot.

It also supports nested validation by the idea of Nested User Controls which propagate validation information to their parent view models or user controls.

It also has support for warnings and works on field and business logic level.

The framework even has an InfoBarMessage control that can display validation information so you won't have to create a template for those.

It also has an extension module that supports Fluent validation, similar to fluent NHibernate or Entity framework but for validation.

like image 145
Ibrahim Najjar Avatar answered Nov 15 '22 14:11

Ibrahim Najjar