5

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!

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, this sounds fine for new projects, nice hint! Using Castel for existing projects (viewmodels) would result in rewriting every viewmodel to extend Catels ViewModelBase, right?
@JonasW i guess so because ViewModelBase contains all the validation logic and implements IDataErrorInfo which Catel uses behind the scenes for send validation information to the WPF engine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.