i have a problem i make a window application and using some Some Wpf user control on my Window Form i want to close my form When I close the user Control,Cancel button how can i achive it.....means i want to get the parent of usercontrol
我有一个问题,我做一个窗口应用程序,并在我的窗体窗体上使用一些Wpf用户控件我要关闭我的窗体当我关闭用户控件,取消按钮我怎么能实现它.....意味着我想得到usercontrol的父级
1 个解决方案
#1
8
The parent of the UserControl
you get with the Parent
-property. The window you can get directly with the Window.GetWindow
-method.
您使用Parent-property获得的UserControl的父级。您可以使用Window.GetWindow方法直接获得的窗口。
Window w=Window.GetWindow(this);
if(null != w){
w.Close();
}
#1
8
The parent of the UserControl
you get with the Parent
-property. The window you can get directly with the Window.GetWindow
-method.
您使用Parent-property获得的UserControl的父级。您可以使用Window.GetWindow方法直接获得的窗口。
Window w=Window.GetWindow(this);
if(null != w){
w.Close();
}