Validate the parent of the parent

Topics: Questions
Jun 17, 2014 at 3:23 PM
If I change a property in the viewmodel also the viemodel is validated and also the parentviewmodel is validated. But not the grandparentviewmodel.

Also not if I call Validate(true).

How to induce that?
Coordinator
Jun 17, 2014 at 3:26 PM
Disclaimer: this is from the top of my head

If you validate a child, the parent will only validate if a property actually changes. Maybe it's because there is not RaisePropertyChanged to cause the grandparent to validate? You should be able to step through it and see where it breaks.
Jun 17, 2014 at 4:06 PM
In the parentviewmodel no property is changed also not in the grandparent.

But in the parentviewmodel I need informations of two childviewmodels to validate. And same in the parentviewmodel.

I try to add the InterestedIn Attribute to the GrandparentViewModel and call validate in OnViewModelPropertyChanged
Then I get a reference of the model of the cildmodel in ValidateBusinessRules. But the property which raised the PropertyChanged Event has the old value.
Jun 18, 2014 at 6:50 AM
Edited Jun 18, 2014 at 7:16 AM
I dont really know why ValidateBusinessRules is called in the parent viewmodel. Only a property is changed in the childviewmodel.
But it should be possible to introduce a validation in parent or in grandparentviewmodel. Or what do you think?
Coordinator
Jun 18, 2014 at 1:41 PM
Catel should automatically validate the whole chain of view models. You shouldn't have to manage this yourself. If you can provide a very basic repro (4 nested vm's with validation, we might find out what's going wrong).
Jun 25, 2014 at 6:55 AM