How to make multiple-view model for a single view

Sep 21, 2010 at 11:22 AM

I have an application with a view. This view is composed of four different areas.
I want a View-Model for each of these areas.

Is it possible?

Thank you.

Sep 21, 2010 at 2:03 PM

Yes. You might consider using a Conductor as base class for a root VM and expose the children VMs as properties of the root one.
Then, in the view associated to the root VM, you have to place 4 ContentControl(s) and name them accordingly to the property containing the child VM you want to "inject" in each area.

Sep 21, 2010 at 3:16 PM

Here is a recent thread that describes exactly what Marco is recommending:

Sep 22, 2010 at 8:56 AM

Thank you very much for the recommendation.

Now raises another question: I have a view composed of four sub-views.
In the View-Model of a sub-view, there is a change in one attribute and notify the change.
How I can propagate this change to the main view to refresh the changes in the sub-view?

Sep 22, 2010 at 11:14 AM

There was a recent discussion about this very topic and the related options available: