I want to close all opened Forms which are child's of a WPF window.
WindowCollection windCollect = this.OwnedWindows;
foreach (Window wind in windCollect)
wind.Close();
It will close all WPF windows, but i need to close Forms also. Someone please help.
Akhil GargPosted Apr 17, 2015, 2:12 PM
PrathapPosted Apr 16, 2015, 2:16 AM
I need to close child forms only , not the whole application
Tom MohanPosted Apr 16, 2015, 2:09 AM
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 callApp.Current.Shutdown();there in.Through App.Current.Windows you have access to all Window-instances. You also can close them manually.