-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
1. Why is so-and-so WinForms control invisible or not rendering? Why the WebBrowser (or other control) covering my flyout (or another control)? [AIRSPACE]
What you are facing is an issue colloquially called the Airspace issue. Due to the different underlying graphical engines used in WinForms (GDI) and WPF (DirectX and such), there are some interop issues. Sometimes your controls will be invisible. Sometimes your WinForms control may overlap your WPF controls.
It is important to know that this is an WPF issue, not a MahApps.Metro one. You can't make the excuse that MahApps.Metro causes this bug but a plain vanilla WPF Window does not. The bug is caused by the Window's AllowsTransparency
property.
By default, the vanilla Window
class has AllowsTransparency
set to false
. MahApps.Metro's MetroWindow
has it set to true
.
One solution to the Airspace issue is to simply set AllowsTransparency
to false
.
<i:Interaction.Behaviors>
<Behaviours:BorderlessWindowBehavior AllowsTransparency="False"/>
</i:Interaction.Behaviors>
The second solution, should for some reason that you need AllowsTransparency
to be set to true
is:
- Go to https://microsoftdwayneneed.codeplex.com/
- Get the lib and add it as a reference to your project.
- Add
xmlns:interop="clr-namespace:Microsoft.DwayneNeed.Interop;assembly=Microsoft.DwayneNeed"
to your XAML. - Place your ReportViewer in the decorator:
<interop:AirspaceDecorator AirspaceMode="Redirect"
Background="White"
IsInputRedirectionEnabled="True"
IsOutputRedirectionEnabled="True">
<!--your winforms control or webbrowser here here-->
</interop:AirspaceDecorator>
Full MahApps documentation is available at https://mahapps.com