I\'m building a project, and one of the biggest problems I\'ve come across until now is navigation.
I\'ve been looking for some time now for examples of caliburn.micro/mvvm
In ShellView you use a content control like this:
ShellViewModel:
public class ShellViewModel : Screen
{
private object Child;
public object Child
{
get{ return child; }
set
{
if(child == value)
return;
child = value;
NotifyOfPropertyChange(() => Child);
}
}
public ShellViewModel()
{
this.Child = new MainViewModel();
}
public void ShowOtherView()
{
this.Child = new FooViewModel();
}
}
So this is a very basic example. But as you see, your ShellView provides a ContentControl
, which shows the child view. This ContentControl
is bound via View.Model
to the Child
property from your ShellViewModel.
In ShellView, I used a button to show a different view, but you can also use a menu or something like that.