当AllowTransparency =“True”时,WindowsFormsHost不可见将其设置为false会有什么风险?

时间:2022-07-04 17:09:17

In my WPF application I set the AllowsTransparency property to be false (AllowsTransparency =“False”).

在我的WPF应用程序中,我将allowsTransparency属性设置为false(allowsTransparency =“False”)。

The only thing that I have been notice is: when I set also Background="Transparent" -> i will get black background (instead of Transparent Background.

我唯一注意到的是:当我设置背景=“透明” - >我将获得黑色背景(而不是透明背景。

What I am missing?

我错过了什么?

Thanks.

2 个解决方案

#1


0  

It's a known issue:

这是一个众所周知的问题:

WPF and WinForms Interoperation Limitations:

WPF和WinForms互操作限制:

WinForms controls cannot be displayed in WPF windows that have the AllowsTransparency property set to true.

WinForms控件无法显示在AllowTransparency属性设置为true的WPF窗口中。

#2


0  

a tip: try to use inside a popup, so it works on separate layer, not a good solution but may help...

提示:尝试在弹出窗口内使用,因此它在单独的层上工作,不是一个好的解决方案,但可能有帮助......

<Popup IsOpen="True" Placement="Relative" PlacementTarget="{Binding ElementName=targetelement}">
<WindowsFormsHost x:Name="host" />
</Popup>

#1


0  

It's a known issue:

这是一个众所周知的问题:

WPF and WinForms Interoperation Limitations:

WPF和WinForms互操作限制:

WinForms controls cannot be displayed in WPF windows that have the AllowsTransparency property set to true.

WinForms控件无法显示在AllowTransparency属性设置为true的WPF窗口中。

#2


0  

a tip: try to use inside a popup, so it works on separate layer, not a good solution but may help...

提示:尝试在弹出窗口内使用,因此它在单独的层上工作,不是一个好的解决方案,但可能有帮助......

<Popup IsOpen="True" Placement="Relative" PlacementTarget="{Binding ElementName=targetelement}">
<WindowsFormsHost x:Name="host" />
</Popup>