WPF用户控件中的按钮事件里,如何取得其所在的Window窗体?
如T, 谢谢!
[解决办法]
可以参照我博客里面的http://blog.csdn.net/fallincloud/article/details/6960255
FindParent的方法,用法Window w = FindParent<Window>(this);
[解决办法]
或者使用App.Current.MainWindow可以获得当前窗口
[解决办法]
可以用这个方法获取控件所在窗体
Button button = sender as Button;
Window targetWindow = Window.GetWindow(button);