Parent WPF Window from a hosted usercontrol
Posted on 2014-03-12
the situation is like this:
we have a method of a Facade (Controller) that gets a Winform User control has a parameter. The given user control is hosted in a wpf parent window.
In simple, if the user control was in the main window of the application, we have to close the MDI tab of that hosted this control.
If the control is from another window, that means that it is showen has a dialog and the parent window should close.
In simple, the question is, how do you get the parent window when you only have a winforms user control?
Would "ParentForm" work ? but then you get a Form object that represent a Window ???
Or maybe "GetWindow" ? But then, since you don't have access to the host object, the Winform user control does not have any of this method... :P