SuspendValidation = true;

Topics: Questions
Nov 17, 2014 at 12:42 PM

How do SuspendValidation works.
  • Do SuspendValidation only works for the viewmodels which calls it.
  • What happens with explicit calls of Validate();
Nov 17, 2014 at 12:44 PM
Yes, only only the (view) models you call it on.

See source to see how it is handled:
Nov 17, 2014 at 12:55 PM

But there is also a property called SuspendValidationForAllModels.

So I can:

SuspendValidationForAllModels = true
//... Do a lot of things
SuspendValidationForAllModels = false

// now I need to validate all (view)models one time. ->

Is there any way to do this?
Nov 17, 2014 at 12:56 PM
If you have a ModelManager of some sort, you can query all the currently alive models. Then you can loop through them. Catel doesn't provide a list of currently alive models.
Nov 17, 2014 at 2:28 PM
Ok. One more question to the validation.

I have a service which loading my models. The models begin to valide if they are loaded. How to suspend the validation in the service?
Nov 19, 2014 at 10:18 AM
A property?