方式一, 通过当前控件名获取父级窗体
Windows targetWindow = Windows.GetWindow(button);
方式二, 通过当前控件获取父级窗体
Windows parentWindow = Windows.GetWindow(this);
方式三, 类 --Application
- Windows mainwin = Application.Current.MainWindow;
- MessageBox.Show(mainwin.Title, mainwin.Title);
来源: http://www.bubuko.com/infodetail-3028713.html