Closed elvince closed 4 years ago
@elvince take a look at the linked PR that I did for this. Rather than putting in an attached property I switched to setting the popup's properties in a style. So for your example I would expect something like this would work for you:
<Style TargetType="{x:Type local:DialogHost}" BasedOn="{StaticResource {x:Type local:DialogHost}}">
<Setter Property="PopupStyle">
<Setter.Value>
<Style TargetType="{x:Type controlzEx:PopupEx}" BasedOn="{StaticResource MaterialDesignDialogHostPopup}">
<Setter Property="AllowsTransparency" Value="False" />
</Style>
</Setter.Value>
</Setter>
</Style>
Thanks for the PR this should work and it's more flexible than my solution. +1!
I saw a side effect to set AllowsTransparency = True. When the popup "close", the popup window is still there. We weren't able to see that before before it was transparent, but when you set it to "false", the background is black :D
I think this is an issue to have the popup window still there & rendering when the popup is closed. Should I open a new ticket for this?
Yea I think a separate issue is best for that. Ideally if you could post a project that reproduces the problem that would be best. Running with my changes in the demo application I am not seeing the behavior (though I have not tried inside of a WinForms app).
ok I will open a new issue. The behavior is not linked to "WindowFormHost" control. I tried without it.
In fact, if you set properly the popup to AllowsTransparency= false, the background is black. If you didn't see it, that might be that the "PR" is not correct.
You can try to put:
`
</Popup>`
That's a standard popup so you can see the black background when it's false.
Your changes should allow to have the same behavior.
Setting AllowsTransparency
to false is not a good option for Popup
. It's maybe better to use the AirspaceDecorator
together with the WindowsFormHost
. This issue is always the same, cause WPF and WinForms have different rendering mechanism.
Here is the FAQ for MahApps: https://github.com/MahApps/MahApps.Metro/wiki/FAQ#why-is-windowsformshost-and-webbrowser-flickering
This has already been addressed in the latest 3.0.0 release
Hi,
Could you please add a new parameter on the DialogHost to manage the AllowsTransparency of "controlzEx:PopupEx" ?
In fact, my case is that I need to set a WindowsFormHost in the popup (PdfViewer) and it's not rendering properly because AllowsTransparency has been set to true. It could be great to be able to manage this case by having a new parameter on the DialogHost so we can set AllowsTransparency = false when needed.
Thanks
For reference, plz find the issue explanation: This is a limitation of using WS_EX_LAYERED and UpdateLayeredWindow(). This form of layered windows does not support child windows. This is a Win32 limitation, not a WPF limitation. Child windows could be used with constant opacity (WS_EX_LAYERED and SetLayeredWindowAttributes) but WPF does not support that mode, as it is more restrictive (constant versus per-pixel opacity).