在wpf上我想知道用户何时按X
退出。
然后我想做一些功能。
我怎样才能在wpf c#上做到?
答案 0 :(得分: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.
}
}