In my WPF application I have created a window and show it as a dialog by calling it by the method ShowDialog(). But when I close the window by Close() method the Unloaded ev
That's a known issue.
Use this instead
yourWindow.Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
private void Dispatcher_ShutdownStarted( object sender, EventArgs e )
{
//do what you want to do on closing
}
Read this for more details
Edit
If above is not working try this
yourWindow.Closing += new CancelEventHandler(YourWindow_Closing);
void YourWindow_Closing(object sender, CancelEventArgs e)
{
}