I have the following line in my Window
stanza in the XAML file:
Closing="Window_Closing"
I originally thought that the web page here assured me that this event fires when you use the big X
close method, Alt-F4
or close
from the system menu yet that doesn't appear to be the case since my breakpoint on the Window_Closing()
function isn't being hit.
It does hit the breakpoint when I do the File
, Exit
method of exiting so that's working okay.
Re-reading that linked page leads me to believe that it may not trigger the closing event.
My questions are:
How do you catch the three methods listed in order to detect if your file is dirty and needs saving? I have all the 'dirty' and file saving code done, I just need to know how to trap the events.
Can you stop the exit from taking place with that method (as you can by intercepting the closing event)? In other words, if the user says they don't want to exit because the accidentally used
Alt-F4
on the wrong window, can it be done?