WPF—DocumentGroup中用到了WindowsFormsHost,窗体浮动的时候winform控件不可见的解决办法

用Dev的DockLayoutManager,其中有DocumentGroup,其中的LayoutPanel窗体浮动后,WindowsFormsHost中的Winform控件就消失了,找了好久才找到解决办法:

将DockLayoutManager.EnableWin32Compatibility 设为true


WinForms controls can be embedded into WPF applications, as described in WPF and Win32 Interoperation Overview. However, there are two major limitations to the WPF and WinForms interoperation that prevent WinForms controls from being used with DXDocking:

  • WinForms controls, when embedded in WPF applications, are always displayed on top of WPF controls.

    Here is an example of this scenario. Assume that a DXDocking dock panel exists with a WinForms control within it. All other panels, when moved or placed over this panel, will be hidden behind the WinForms control.

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

    All dock panels have the AllowsTransparency property set to true. This ensures correct display of the panel's borders and shadows. However, WinForms controls are hidden when they are displayed within windows that support transparency.

To overcome possible issues with auto-hide panels and float panels overlapped by WinForms controls, set theDockLayoutManager.EnableWin32Compatibility property to true. This action will set the AllowsTransparency property for all floating WPF windows to false and force auto-hide panels to be drawn over a WindowsFormsHost object. The DockLayoutManager.EnableWin32Compatibilityproperty is in effect for floating panels only in the FloatingMode.Desktop mode.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值