WPF Page页调用、触发Window的实现

//window窗体的代码
public partial class win_Main : Window
    {

        /// 
        /// 子页Page调用本窗体的方法
        /// 
        ///  frd 2011-9-20 16:37
        public  void CallFromChild()
        {
            MessageBox.Show("this is call from child page!");
        }

        /// 
        /// 打开Page事件
        /// 
        ///  frd 2011-9-20 16:37
        private void img_SeatConfig_MouseUp(object sender, MouseButtonEventArgs e)
        {
        
             pag_SeatConfig pag_seatconfig = new pag_SeatConfig(EachCount);
             pag_seatconfig.ParentWindow = this;
             this.frame_Main.Content = pag_seatconfig;
        }
   }


//Page页的代码  
     
      /// 
        /// 子页Page
        /// 
        ///  frd 2011-9-20 16:37
    public partial class pag_SeatConfig : Page
    {


        win_Main parentWindow;
        public win_Main ParentWindow
        {
            get { return parentWindow; }
            set { parentWindow = value; }
        }

        private void image_Commit_MouseUp(object sender, MouseButtonEventArgs e)
        {

            parentWindow.CallFromChild();

        }

      }


你可能感兴趣的:(.NET)