To create and open a new Window, the Owner of the new Window has to be set to be the object reference of the parent Window from which the new Window is to be opened.
E.g. Without MVVM
private void btnTest_Click(object sender, RoutedEventArgs e)
{
WdwTestWPFWindow wdwTestChild = new WdwTestWPFWindow(); // A regular XAML WPF window
wdwTestChild.Owner = wdwParent; //wdwParent is the current Window from which the test Window is to be opened
wdwTestChild.ShowDialog();
wdwTestChild.ShowDialog();
}
How can we do the same thing using MVVM? How can the Owner of the child Window be set in MVVM, given that in MVVM the ViewModel which will be handling the button click event (instead of the code behind) does not have a reference of the View that consumes it and therefore will be unable to set the Owner property of the child Window?