Reputation: 6367
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
Upvotes: 5
Views: 4279
Reputation: 36815
The parent of the UserControl
you get with the Parent
-property. The window you can get directly with the Window.GetWindow
-method.
Window w=Window.GetWindow(this);
if(null != w){
w.Close();
}
Upvotes: 8