So you can enable ViewSwitching navigation in your MVVM application.
Other missing bits: in view β
<ContentControl Content="{Binding CurrentPage}" />
in ViewModel -> (pseudo-code)
Prop ViewModelBase CurrentPage.
Note that if all you need is to connect the ViewModel to the view, you can simply completely delete all the DataTemplate-ContentControl information and just do it .DataContext = new SomeViewModel (); in code.
The cleanest way I can connect a VM to Views is to use the ViewModelLocator template. Google ViewModelLocator.
source share