WPF中获取主窗口 MainWindow 实例,以及在其他窗口中获取 MainWinodw 中的控件
var _mainWindow = Application.Current.Windows
.Cast<Window>()
.FirstOrDefault(window => window is MainWindow) as MainWindow;
var _mainWindow = Application.Current.Windows
.Cast<Window>()
.FirstOrDefault(window => window is MainWindow) as MainWindow;