[英]how can i get the parent of user control wpf
我有一个问题,我做一个窗口应用程序,并在我的窗口窗体上使用一些Wpf用户控件我要关闭我的窗体当我关闭用户控件,取消按钮我怎么能得到它.....意味着我想得到usercontrol的父级
The parent of the UserControl
you get with the Parent
-property. 使用
Parent
-property获得的UserControl
的Parent
。 The window you can get directly with the Window.GetWindow
-method. 您可以直接使用
Window.GetWindow
-method获取的窗口。
Window w=Window.GetWindow(this);
if(null != w){
w.Close();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.