So, how do you handle child ViewModels with NoMvvm?  It is actually similar to Caliburn, except simpler.

This is a case where you have a "parent" view with a "child" view displayed inside it.

Here is what you would do in Xaml:

<ContentControl Content="{Binding Child.View}" />

Then, merely set This.Child in your ViewModel:

This.Child = IoC.GetViewModel("YourChild");

This, also works with INotifyPropertyChanged appropriately if you need to switch child ViewModels.  You may replace Child with whichever name you wish.

How to handle popup windows?  Just try this from your parent ViewModel:

var viewModel = IoC.GetViewModel("Popup");
var view = viewModel.View;
view.Owner = Runtime.MainView;

Last edited Aug 31, 2011 at 2:37 AM by jonathanpeppers, version 4


No comments yet.