In WPF I want to change default close behaviour of some window, so that when user clics red close button the window does not close, it merely hides (and call some method as well). How can I do that?
Try overriding OnClosing in Window.xaml.cs
private override void OnClosing( object sender, CancelEventArgs e ) { e.Cancel = true; //Do whatever you want here.. }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With