WPF closing all windows when user closes one of them
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 t开发者_开发知识库o run as processes. Is it possible to close all of them when user closes any.
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.
精彩评论