about WindowsFormsHost


  • I use WindowsFormsHost to host a Windows.Forms.PictureBox control in a WPF application

    I want to cover it with some other WPF controls( e.g. Image), but no control in WPF can appears in front of the WindowsFormsHost control.

    Why? How?

    Thank you!

    Wednesday, September 27, 2006 3:26 AM


All replies

  • Thursday, September 28, 2006 12:38 PM
  • Plain and simple the WPF compositing engine and the Winforms (i.e. User32/GDI+) engine do things quite differently. Because of those differences (and also the fact that WPF has no control over whether a Winforms control is using DirectX or not), WPF controls and WinFormsHost can't exist in the same space....well they can but guess who's getting their Z-index sent to the back?
    Thursday, September 28, 2006 1:32 PM
  • And there's actually no way to set the Z-index of WindowsFormsHost (WFH) control to a value lower than the WPF user control?!

    This su*ks bigtime!!! >(

    I've managed to move around my fullscreen app in windows 7 using win + arrow key combo and have then the WPF (virtual keyboard) control visibly render in the background (though semi-partially obscured) by adding a button to Open/Close it after WPF Window loads....after whose opening I've been able then to move around that WPF usercontrol of mine on top of WFH control which is displaying a Gecko web browser control inside, so I know it's possible somehow....I just don't know how to manage that in managed C# code (please don't tell me you have to use Win32 API Hwnd and stuff)?!?


    Tuesday, June 14, 2011 4:14 PM