We are using the WPF HwndHost control to host a Win32 Control (from an external C++ DLL). This HwndHost is embedded in a DocumentWindow, inside a Workspace, in a DockSite, the ususal. Works great until we undock the DocumentWindow, and the HwndHost no longer shows the navite HWND as expected.
I'm fairly certain this is because of the well known .NET "airspace" issue.
MSDN Technology Regions Overview
In general, you can't ever put any WPF content on top of an HwndHost, unless it's in a WPF Popup. It's great that your DockingWindow based controls can actually sit on top of an HwndHost, so you are doing that part right. However, when the HwndHost is inside a DockingWindow, it can get confused.
Basically, WPF applications have a single HWND, and upon creation, the HwndHost uses that as the Parent HWND for the Win32 Control. When the DocumentWindow starts to float, I'm assuming it's put into a WPF Popup of some sort. WPF Popup controls have their own HWND, and the disconnect is causing the problem.
Once we re-dock the DocumentWindow, the Win32 Control behaves as expected.
Sooooooooo, the short question is, any suggestions?
The long question is, hey, by the way, there are other problems with the airspace issue, like AutoHide ToolWindows don't overlap and HwndHost property when expanded, but floating DockingWindows overlap just fine.
.NET 4.5 is supposed to address this on some level, but it's still unproven since it's not released.
I'm fairly certain this is because of the well known .NET "airspace" issue.
MSDN Technology Regions Overview
In general, you can't ever put any WPF content on top of an HwndHost, unless it's in a WPF Popup. It's great that your DockingWindow based controls can actually sit on top of an HwndHost, so you are doing that part right. However, when the HwndHost is inside a DockingWindow, it can get confused.
Basically, WPF applications have a single HWND, and upon creation, the HwndHost uses that as the Parent HWND for the Win32 Control. When the DocumentWindow starts to float, I'm assuming it's put into a WPF Popup of some sort. WPF Popup controls have their own HWND, and the disconnect is causing the problem.
Once we re-dock the DocumentWindow, the Win32 Control behaves as expected.
Sooooooooo, the short question is, any suggestions?
The long question is, hey, by the way, there are other problems with the airspace issue, like AutoHide ToolWindows don't overlap and HwndHost property when expanded, but floating DockingWindows overlap just fine.
.NET 4.5 is supposed to address this on some level, but it's still unproven since it's not released.