当WPF关闭时执行代码 [英] Execute code when a WPF closes
本文介绍了当WPF关闭时执行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这可以由于这个回答的问题:
但是我需要一些方向。 p>
谢谢=)
解决方案
只是这个XAML
< Window ... Closing =Window_ClosingClosed =Window_Closed>
...
< / Window>
和关闭
和关闭
事件
private void Window_Closing(object sender,System.ComponentModel.CancelEventArgs e)
{
...
}
private void Window_Closed(object sender,EventArgs e)
{
....
}
I am not familiar with using event handlers, and I was wondering if anyone had or could direct me to some code that shows how to use an event handler that will execute code on the Close/Closed event?
I know this can be done because of this answered question:
But I need some direction.
Thank you =)
解决方案
It's just this XAML
<Window ... Closing="Window_Closing" Closed="Window_Closed">
...
</Window>
and code for both the Closing
and Closed
events
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
...
}
private void Window_Closed(object sender, EventArgs e)
{
....
}
这篇关于当WPF关闭时执行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文