Dynamicaly attaching UserControls to a Window and VM interaction

May 18, 2011 at 12:22 PM
Edited May 18, 2011 at 7:52 PM

Hello,

yesterday I started exploring this cool framework, I can not say I am expert in C# and WPF, mostly experienced in Java.

I ran into following problem:

I want to have only one window with buttons on the left, each button click to open a separate UserControl. Some of the nested UserControls would have another one nested in them and they would be again dynamically loaded based on a ListBox selection.

I was wondering if this is possible using your static VM Locator, and also how to notify the View that it needs to load a different User Control. 

Edit: I have a separate ViewModel for each dynamicaly loaded UserControl and actually the approach i am taking right now is to assign different viewmodel objects to a property, to which then I bound the content of ContentControl element. I am using Entity framework for generating my model entities, not sure if this somehow affects the framework.

Any help would be greatly appriciated!

Thanks in advance.