I am using an animation to show a custo开发者_Python百科m showdialog popup (Border control with some TextBlock and Button). After taking the WinFormHost if iam runnig the Animation , the border control and other will be going behind the WinFormHost. Is there any round about for that?
There is no workaround for this if you want the WPF and Windows Forms content to share the same window.
WPF renders via Direct3D, whereas Windows Forms uses GDI+, which is ultimately based on the old GDI32 rendering mechanisms. Windows itself doesn't provide a way to render to the same region of a window with these two different technologies - you end up with an HWND owned and rendered by Direct3D (as used by WPF), and a different HWND owned and rendered by Windows Forms. These HWNDs carve up the space in their containing window between them and can't overlap.
If you want overlapping WPF and Windows Forms content, the only supported way to do that is to put them in separate top-level windows - Windows does support overlapping Win32 and Direct3D content at the desktop level. You can use per-pixel transparency to make a non-rectangular window (either in WPF or Windows Forms). So you can turn off all the window borders in your WPF app, and make the background transparent, and if you've enabled transparency, you can then position that window in exactly the same place on screen as your Windows Forms window, at which point you can now have WPF content on top of your Windows Forms content.
Needless to say, this is a tedious thing to do. But unfortunately, that's what you need to do if you really need WPF content on top of Windows Forms content - you need to put the WPF content in a separate window.
精彩评论