I was looking at a video that explain pretty well MVVM. However, it seem to only show an one window application model. What do you have to do if you want to handle a multi-windows model ?
From what i see.. the app.xaml is linked to the MainWindow (as DataContext). Since app.xaml is the starting point it execute the MainWindow. The MainWindow have ViewModels as a bind so it can handle his ViewModels.. but all this are only for one windows.. what happen with you want to introduce a second window ? How do you proceed ?
Thanks.
You can instantiate your view (
Window) type from the main windows view model via a service, injected as an abstraction. You can then set theDataContextof this Window programmatically within the service, locate the appropriate view and usemyWindow.Show()ormyWindow.ShowDialog()to display the Window. An MVVM framework such as Caliburn.Micro has aWindowManagerfor taking care of the view location and view/view model binding for you.