I created new WPF Application witn two windows.
- MainWindow.xaml
- Window1.xaml
Added one button in MainWindow.xaml and wrote the following code in the click event of the button:
Window1 w = new Window1();
w.Show();
I clicked that button 2-3 times and it opened multiple instances of Window1.
Everything fine till here.
Now, I closed MainWindow and it did not close the instances of Windows1.
I was thinking that since MainWindow is the one that owns the Process and if it closes, rest of the child windows will close automatically.
I did the same project in WinForms application and the result was completely different. On closing the MainWindow, it did close rest of the windows.
Am i not understanding the concept clearly? Can someone tell me who owns the process or the main thread in WPF?