在WPF中我想更改某个窗口的默认关闭行为,这样当用户点击红色关闭按钮时窗口不会关闭,它只是隐藏(并调用某些方法).我怎样才能做到这一点?
Job*_*Joy 38
尝试在Window.xaml.cs中重写OnClosing
private override void OnClosing( object sender, CancelEventArgs e )
{
e.Cancel = true;
//Do whatever you want here..
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27972 次 |
| 最近记录: |