Error in nestedviewmodel

Apr 30, 2013 at 1:05 PM
Edited Apr 30, 2013 at 1:22 PM
Can I get noticed in the parentviewmodel when a error exist in an nested viewmodel.

I need somethink like the [ValidationToViewModel(IncludeChildViewModels = true)].
But not for command but for an property of type bool.
Apr 30, 2013 at 7:45 PM
The ValidationToViewModel is the way to go. It gathers a validation context and updates a specific property on your view model containing the validation summary. So inside a view model, you do this:

[ValidationToViewModel(IncludeChildViewModels = true)]
public IValidationSummary PersonValidationSummary { get; set; }

Then you can check the IValidationSummary.HasErrors when you need it.
May 2, 2013 at 7:42 AM
Thank you very much. Thats brilliant.
May 6, 2013 at 8:31 AM
Hello again.

Next Problem. I use ValidationToViewModel with IncludeChildViewModels and Tag. But now my Application is very slow. The problem is that i have nested viewmodels with 4 hierarchy levels. In the deepest level there are many viewmodels.

In the topviewmodel I just need to validate the levels 1-3. So is it possible to exclude a viewmodel level from the validation?
May 7, 2013 at 10:04 AM
No, this is not possible.
May 8, 2013 at 1:35 PM
Hm. Ok what to do.

The IValidationSummary Property get is now called about 100 times. Everytime I change a property in a viewmodel in the nested viewmodel hierarchy.
May 18, 2013 at 5:17 AM
Is the validation complex? Maybe a check should be added to prevent a change in case the validationsummary has not changed. You can add the feature request at http://catelproject.atlassian.net. Note though that I am currently on vacation until mid June so I wont have time soon.
May 21, 2013 at 12:36 PM
Ok. I added an new Issue.

Can I edit the issue? I set the Priority to Critical. Thats to high, I thinks Major is enough for me :-)
Jun 11, 2013 at 11:06 AM
Hi.

See you have fixed my issue. I have tested it. And i works great. My Application is faster then ever. Thank you very much.
Jun 11, 2013 at 12:48 PM
Thanks for letting us know :-)