弹出窗体主体实现事件

窗体程序(NewWindows)

public delegate void OkClickHandler(NewWindowsModel model);
public event OkClickHandler OkClickEvent;
private void btnOK_Click(object sender, System.Windows.RoutedEventArgs e)
 {
       var n = new NewWindowsModel()
        {
            Name = textBox1.Text,
             Formula = textBox2.Text
         };
         OkClickEvent(n);
         Close();
}

 

主体程序(窗体事件放在主体程序执行)

private void AddNewField(object sender, RoutedEventArgs e)
{
      var w = new NewWindows() { Owner = Application.Current.MainWindow};
      w.OkClickEvent += AddNewNode;
      w.ShowDialog();
}

 private void AddNewNode(NewWindowsModel model)
{
 ....

}

弹出窗体主体实现事件

上一篇:windows phone 8.1常用启动器实例


下一篇:windows phone 8.1 FlipView 实现照片自动浏览