There's a WPF application with multiple windows. Initially there's only one window. User may go to next windows while previous are hidden. When they return back, hidden windows appear again. The problem is that when user closes some window, the hidden ones continue to run as processes. Is it possible to close all of them when user closes any.
The proper way to shutdown a WPF app is to use Application. Current. Shutdown() . This will close all open Window s, raise some events so that cleanup code can be run, and it can't be canceled.
WPF is still one of the most used app frameworks in use on Windows (right behind WinForms).
The Window. close() method closes the current window, or the window on which it was called. This method can only be called on windows that were opened by a script using the Window.
WPF uses XAML as its frontend language and C# as its backend languages. WPF was introduced as a part of . NET Framework 3.0 as the Windows library to build Windows client apps and the next generation of Windows Forms.
If you want to terminate an application with all windows, you can call App.Current.Shutdown();
. If you want call this on closing of any window, register to the Window.Closed event and call App.Current.Shutdown();
there in.
Through App.Current.Windows you have access to all Window-instances. You also can close them manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With