Check UnsavedChanges in OnNavigatingFrom

Nov 7, 2013 at 3:31 PM
I need check if there is any unsaved changes before quitting the application or leave the current page. I do it in OnNavigatingFrom. It works fine when leaving the current page. But OnNavigatingFrom is not called when I quit the application by closing the main window.

I can do it in Windows Unloaded event handler. But I will have to check unsaved changes in 2 places (OnNavigatingFrom and Windows_Unloaded). Is there a better way?

Thanks.