2017-09-13 8 views
-5

wpfで、ユーザがXを押して終了するときを知りたい。WPF action befor exit

次に、いくつかの機能を実行したいと思います。

どのようにwpf c#で行うことができますか?

答えて

1
public partial class MainWindow 
{ 
    public MainWindow() 
    { 
     InitializeComponent(); 
     this.Closing += (sender, args) => ...; // Occurs after X is pressed. You can cancel closure here. 
     this.Closed += (sender, args) => ...; // Occurs when the window is already closed. 
    } 
}