Geeks With Blogs
Mark Pearl


Today I spent the better part of an hour trying to figure out what I had had done wrong. I had an application that when the user click’s “exit”, it should prompt if they want to save the last unsaved file, or cancel the exit. If the select cancel it should not exit the application. Everything seemed fine in my code, all I was doing was calling


And then capturing the Closing event and setting cancel to true.. (see SO question here)

Long story short, If should not have been calling Application.Current.Shutdown() but rather Application.Current.MainWindow.Close().

grrrr… <I must read documentation properly>

Posted on Thursday, January 6, 2011 2:06 PM C# | Back to top

Comments on this post: Cancelling WPF Application.Shutdown

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © MarkPearl | Powered by: