方式一、通过当前控件名获取父级窗体 Window targetWindow = Window.GetWindow(button); 方式二、通过当前控件获取父级窗体 Window parentWindow = Window.GetWindow(this); 方式三、类--Application Window mainwin = Application.Current.MainWindow; MessageBox.Show(mainwin.Title, mainwin.Title);
方式一、通过当前控件名获取父级窗体 Window targetWindow = Window.GetWindow(button); 方式二、通过当前控件获取父级窗体 Window parentWindow = Window.GetWindow(this); 方式三、类--Application Window mainwin = Application.Current.MainWindow; MessageBox.Show(mainwin.Title, mainwin.Title);
转载于:https://www.cnblogs.com/xunyiHe/p/10734697.html