找不到WindowsFormsHost错误IsRedirected?
我正在使用的WPF项目添加WINFORM图表
System.Windows.Forms.Integration.WindowsFormsHost
我正在尝试解决“空域”渲染问题,其中主机始终被渲染为窗口的最顶层元素。 我正在使用集合的解决方法
IsRedireced = "true"
当我将其插入到我的XMAL代码中时:
或者我的代码背后:
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); host.IsRedirected = "true";
我收到以下错误:
"The property 'IsRedirected' was not found in type 'WindowsFormsHost'
这是一个截图:
错误http://sofzh.miximages.com/c%23/2eal2k7.jpg
任何人都可以帮助解释为什么会这样吗? 我继续需要在我的WINFORM图表上显示一个元素!
谢谢
编辑:
代码取自MSDN网站: http : //msdn.microsoft.com/en-us/library/ms752027.aspx
来自MSDN:“默认情况下,可见的WindowsFormsHost元素总是在其他WPF元素之上绘制,并且它们不受z顺序影响。要启用z-ordering,请将WindowsFormsHost的IsRedirected属性设置为true,将CompositionMode属性设置为Full或OutputOnly。要查看默认的z顺序行为“
“将以下XAML复制到Grid元素中。”
Press F5 to build and run the application. The WindowsFormsHost element is painted over the label element.
“在IsRedirected为真时查看z顺序行为”
Replace the previous z-order example with the following XAML. XAML Press F5 to build and run the application. The label element is painted over the WindowsFormsHost element.
Microsoft .NET Framework 4.5 Beta自述文件
1.3.10 Windows Presentation Foundation(WPF)
1.3.10.1已在.NET Framework 4.5 Beta中从WPF中删除了HwndHostfunction
.NET Framework 4.5开发人员预览版包含WPF HwndHost重定向function。 但是,此function有几个已知问题,已从.NET Framework 4.5 Beta中删除。 它将不会包含在任何将来的版本中。
要解决此问题:
没有可用的解决方法。
(重点补充)
你在这里使用哪个.Net Framework。 用于WindowsFormHost的IsRedirected随Framework 4.5一起发布