Nested validations are not reported back to parent viewmodels

"As the image above shows, all children in the chain are validated, and when the last child is validated, the view model reports the result of its children and itself back to its parent. This way, it is still possible to disable a command when one of
the nested user control view models has an error."

But I can't retreive on parent viewmodel the nested viewmodels validation results.

I'm evaluate the parent viewmodel on the OnValidated event, so I can see the child viewmodels with it's errors. But the errors are not reported back to the parent.

At this point I can't disable a command when a nested view model has an error.

The actual errors are contained by the child view model itself. Internally, the viewmodelbase checks whether the HasErrors property of a child view model is true. If so, the HasErrors of the parent view model returns true like this:

I understand that you want to retrieve the ValidationContext of the child items, right? I am not sure whether it is a good idea to add all the errors to the parent view model (quite some error management). What I am currently thinking of is creating a method
like this:

IEnumerable<IViewModel> GetChildViewModels()

Then you can retrieve the ValidationContext of each view model and maybe I can even write a GetHierarchyValidationContext that loops all the childs (but this will be a hit on the performance).

So, How the InfoBarMessageControl works? I'm pretty sure that I saw it works on a DataWindow with a couple of tabs where each tabitem contains it's own viewmodel.

I'm trying to use it (the InfoBarMessageControl) on my own UserControl but doesn't work as I expected. I'm really stuck now.

Allow me depicts my scenario.

[Shell] --> Is a UserControl<T>.

[RadRibbonView]

[RibbonButtonViewModel] --> Each button view model are interested in the well knows view models, so I send here the validation summaries (no problems here), canexecute works.

[RibbonButtonViewModel] --> ...

[InfoBarMessageControl] --> I expect show all tabs errors here (but doesn't show), The
WarningAndErrorValidator is bound to the shell.

[RadTabControl]

[RadTabItem] --> View injected with following the PRISM approach. (Each view (UserControl<T>), content of the RadTabItem) has it own view model (ViewModelBase)).

[UserControl1] --> Here I have a master/details situation with complex editing approach. Here I have a Button (eg: Add) looks like the validation sequence of the nested control do
not affect here, so the can execute never occurs.

[UserControl2] --> Here I edit data about the selection, the validation
occurs, the controls shows it's red flag, but the errors doesn't report's back to the parent control.

[RadTabItem] ...

I have an idea how "solve" it, but I need you opinion how solve this issue.

Each UserControl<TViewModel> implementation automatically wraps itself in a grid and adds a WarningAndErrorValidator. This is some kind of ValidationSummary that the InfoBarMessageControl listens to and gathers all the errors from all the WarningAndErrorValidator
instances.

The WarningAndErrorValidator you are talking to is positioned outside the InfoBarMessageControl (which is a contentcontrol), so that's probably the cause of the errors not showing up.

2. My workaround (for a while) will be report the summary to the parent control and makes the parent control interested in the child ones. The same solution on my RibbonButtonViewModels.

You can include a new ViewModelBase or DataObjectBase or UserControl<T> property which allow to the developers decide whether he wants the errors reports back to the parents view models automatically. They have to deal with the performance issue if they set the property to true. So, you don't have to write new properties.

Darn, you are right,. I forgot to implement that one. I think I was too busy preparing the beta nuget packages. Yes, you read it right, I wrote tons of scripts to make it much easier to deploy Catel to nuget.

I will implement this, and will release a nuget beta for the first time tonight!

Thanks! I have added the fix and it will be included of the beta that will be released tonight. Now if there would only be some kind of notification mechanism to let people automatically know that a beta has been released. That would be cool.

Too bad that the @catel twitter account is already taken, otherwise we could send out a twitter message automatically.

The only real reference that you need is this one: /Catel.Windows;component/themes/generic/controls/InfoBarMessageControl.generic.xaml

You don't have to create the forwarders, it's for margins only.

I am working to get the documentation as complete as possible, but it's the least nice part of the project, and there are so much things to do that sometimes the documentation is not fully completed. However, when we implement a new feature, we always document
it to prevent more documentation to be outdated.

The approach is indeed the same. Just add the behavior and you are good to go. Actually, in Silverlight a Window is just a control, so in fact they are the same. I will try to fix this documentation, but so much to do :)

About the validation: no. The issue is that the UserControl<TViewModel> automatically adds this to your user control:

<catel:WarningAndErrorValidator Source="{Binding}" />

However, if you are using a custom control, this is not implemented and you need to add this yourself. Internally, the WrapControlHelper class is responsible for all this stuff. Since I think it can be useful, I just made it public so you can use it.

ValidationToViewModelAttribute with include childviewmodels set to 'true' are not working properly on master details escenario.

I have no a clue at this time, just noticed that the auto-injection is failiing when a new nested level is created.

Typically I have two levels, under certain conditions I create a new one following the master/details approach. (The third level has no validator)

I'm using external validators, then I thought that was an error on my validation approach but I force an error reporting on ValidateFields event at the second level and nothing happeds. The first level summary report including childs have zero errors.

This is probably because only a property on the child changes, and then the parent view model has no clue of the change. I will take a look at the nested validation to see whether I can keep track of the PropertyChanged event of HasErrors and HasWarnings
on the child view models. That should solve the issue.

Server Error in '/' Application

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Seems that it works for some one with a normal internet access and speed. A directory with name 'FDEA4A04A9A548A4975D787C0D9034805' was created, containing (a 0 KB file for me) named Catel.Silverlight.pd_.