tags:

views:

32

answers:

1

When the "x" is pressed in the title bar of a WPF form, where does the control go to? Is there a way of capturing this selection so that certain things can be done (like closing db connections) before exiting the code? Thanks for your help! VR

+1  A: 

Similar to WinForms there are events on the form object that allow you to react to closes, including suppressing them. Check http://msdn.microsoft.com/en-us/library/ms748948.aspx - documentation is in there.

TomTom
Specificaly, this section: http://msdn.microsoft.com/en-us/library/ms748948.aspx#Closing_a_Window
svick