c# - WPF action befor exit -


on wpf want know when user press on x exit.

then want functions.

how can on wpf c#?

public partial class mainwindow {     public mainwindow()     {         initializecomponent();         this.closing += (sender, args) => ...; // occurs after x pressed. can cancel closure here.         this.closed += (sender, args) => ...; // occurs when window closed.     } } 

Comments