wpfvisibilityhwndhost

Force BuildWindowCore member of a HwndHost derived class to be called


I use a class derived from HwndHost to host a Win32 window. It is in turn used within a user control. That user control doesn't get shown (Visibility) unless the internal Win32 window gets successfully created. However, the BuildWindowCore method doesn't appear to be called unless the HwndHost window is visible, so I have a chicken & egg situation.

If a HwndHost derived class is not visible, is there another way to get it's BuildWindowCore method called?


Solution

  • Well, a month has passed with no answers. Looks like I've stumped everyone including myself.

    So, the answer as of .NET 4.0 is "No, there is no way to force BuildWindowCore to be called before the framework is ready to call it."