Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The opinions about validation differ from person to person. Some people think it is best practice to immediately show the errors to the users. Others want to defer it to the moment where the user clicks the Save or OK button. Catel supports both "best practices".

Table of Contents

Suspending validation for a batch of changes

Sometimes you need to change a batch of properties and don't want validation to be called after every property change. This can be accomplished by using the following code inside a ModelBase class:

Code Block
SuspendValidation = true;
 
// change several properties here
 
SuspendValidation = false;
 
// Now force validation
Validate(true);

Deferring validation in view models

Below is a table of properties that can be used to affect the validation deferring.

...