WPF获取当前用户控件的父级窗体
方式一、通过当前控件名获取父级窗体 Window targetWindow = Window.GetWindow(button); 方式二、通过当前控件获取父级窗体 Window parentWindow = Window.GetWindow(this); 方式三、类--Application Window mainwin = Application.Current.MainWindow; MessageBox.Show(mainwin.Title, mainwin.Title);

浙公网安备 33010602011771号