SuspendValidation = true;

Topics: Questions
Nov 17, 2014 at 11:42 AM

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 11:44 AM
Yes, only only the (view) models you call it on.

See source to see how it is handled:
Nov 17, 2014 at 11:55 AM

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 11:56 AM
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 1: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 9:18 AM
A property?