Reputation: 8509
I have few WPF windows.
When I want to open a new window, I will close the current one, and load a new one:
ProductMain productMain= new ProductMain();
productMain.Show();
this.Close();
I know you can put user control into window.
Can I load the window in a main window?
Thank you.
Upvotes: 0
Views: 223
Reputation: 3545
You can do something like that by setting the Window's owner property. To get the main window use:
Application.Current.MainWindow
After that, you can set the owner of the ProductMain window:
ProductMain productMain= new ProductMain();
productMain.Owner = Application.Current.MainWindow;
productMain.Show();
Upvotes: 2