标签:partial 代码 同步 pre eth 坚持 cli 子窗口 bsp
SubWindow 子窗口代码
public partial class SubWindow : Window { public delegate void UpdateDelegate(); public UpdateDelegate myHandle; public SubWindow() { InitializeComponent(); this.Closed += SubWindow_Closed; } private void SubWindow_Closed(object sender, EventArgs e) { myHandle(); } }
主窗口代码
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { SubWindow s = new SubWindow(); s.myHandle += Method1; s.Show(); } private void Method1() { MessageBox.Show("子窗口要关闭啦。我们也要同步关闭了。"); this.Close(); } }
【2016-11-6】【坚持学习】【Day21】【子窗口关闭时,同步关闭它的主窗口】
标签:partial 代码 同步 pre eth 坚持 cli 子窗口 bsp
原文地址:http://www.cnblogs.com/zscmj/p/6034751.html