在WindowsFormsHost顶部呈现WPF控件

在WindowsFormsHost顶部呈现WPF控件

本文介绍了在WindowsFormsHost顶部呈现WPF控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道默认的WPF行为是先渲染WPF控件,然后再渲染WinForms,但是有什么方法可以在WindowsFormsHost之上渲染WPF?

I know that default WPF behavior is to render WPF controls and then on top render WinForms, but are there any way to render WPF on top of WindowsFormsHost?

编辑:我也发现了临时黑客.当wpf控件与WindowsFormsHost重叠时,我会更改WindowsFormsHost的大小(仅当您具有重叠的矩形对象时才起作用,而对其他形状则无效.)

Edit: I have found a temp hack as well. When wpf control overlaps WindowsFormsHost, I change the size of the WindowsFormsHost (This only works when you have rectangular object which overlaps, doesn't work for other shapes.)

推荐答案

此空域"问题是假设已修复.有几种解决方案,例如此处此处,以及此处.

This "airspace" issue is suppose to be fixed in WPF vNext. There are a couple solutions out there, such as here, here, and here.

一种方法是将WPF内容托管在透明的Popup或Window中,该窗口会覆盖Interop内容.

One way to do this is to host the WPF content in a transparent Popup or Window, which overlays the Interop content.

这篇关于在WindowsFormsHost顶部呈现WPF控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 15:21