When you create a fancy WPF window with AllowTransparency set to true, all WindowsFormsHost controls will be invisible because of some underlaying incompatible drawing methods.
This issue also causes the WPF WebBrowser control to be invisible on transparent windows. Chango V. has worked out a solution which creates an overlay for the WebBrower. I've created a similar solution for the WindowsFormsHost control. We make use of a separate non-transparent window which overlays a target FrameworkElement in the transparent window.
It seem to work fine, so I want to share it with the world. Here is the sourcecode:
WindowsFormsHostOverlay.xaml
WindowsFormsHostOverlay.xaml.cs
Here is a small (and incomplete) example of how you use WindowsFormsHostOverlay:
XAML
CS
Great!
BeantwoordenVerwijderenIs it OK to use this code in my application?
Best regards Peter
Great you like it :-)
BeantwoordenVerwijderenYou can use the code any way you want.
hi
BeantwoordenVerwijderenOwner = Window.GetWindow(t); in error
Cannot set Owner property to a Window that has not been shown previously.
Yasin, errordescription is selfexplaining...
BeantwoordenVerwijderenShow the target window prior construction the WindowsFormsHostOverlay.
Can you sent project to mail - flai@bigmir.net?
BeantwoordenVerwijderenI've been using this in a large project which I can't send. I don't have a small testproject for this.
BeantwoordenVerwijderenBut you should get it running with the provided code.
Holy moly! This is great! I've been using it to host stupid ActiveX-Controls and it works tremendously good.
BeantwoordenVerwijderenThanks a lot Maarten!