Can somone give me an example why would I need a ViewModel taht contains two sub View models ? and how do I implement this ?
Assuming you got a "MainContainer" which is your top-level ViewModel, you might need 2 different sub-viewmodels: One for a "Menu" and one for the content that the menu points to.
It could be implemented like this:
public MenuViewModel Menu;
public ContentViewModel Content;
You'd bind a container in your main view to each of these viewmodels, and on update insert a view depending on your viewmodel. How you map the viewmodels to the view, can depend, and there's no "pretty" solution. Personally, I like to keep it in my top-view resources, using a datatemplate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With