找不到WindowsFormsHost错误IsRedirected吗? [英] WindowsFormsHost error IsRedirected is not found?

查看:239
本文介绍了找不到WindowsFormsHost错误IsRedirected吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WPF项目添加WINFORM图表

I am adding a WINFORM chart to my WPF project using

 System.Windows.Forms.Integration.WindowsFormsHost

我正在尝试解决空域"渲染问题,在该问题中,主机始终被渲染为窗口的最顶层元素.我正在使用集的解决方法

I am trying to work around the "airspace" rendering issue where the host is always rendered as the top most element the window. The workaround I am using sets

IsRedireced = "true"

当我将其插入我的XMAL代码时:

When I insert this into my XMAL code:

        <Grid x:Name="ssCurveChartGrid" Grid.Column="1" Margin="110,30,160,306" Grid.ColumnSpan="4" RenderTransformOrigin="0.479,0.186">
        <WindowsFormsHost IsRedirected =" "true">

        </WindowsFormsHost>
    </Grid>

或我后面的代码:

System.Windows.Forms.Integration.WindowsFormsHost host =
            new System.Windows.Forms.Integration.WindowsFormsHost();

host.IsRedirected = "true";

我收到以下错误:

在类型"WindowsFormsHost"中找不到属性"IsRedirected"

The property 'IsRedirected' was not found in type 'WindowsFormsHost'

以下是屏幕截图:

任何人都可以帮助解释为什么会这样吗?我需要在WINFORM图表上方显示一个元素!

Can anyone help explain why this is happening? I relay need to display an element on top of my WINFORM chart!

谢谢

代码摘自MSDN站点: http://msdn.microsoft. com/en-us/library/ms752027.aspx

Code was taken from MSDN site: http://msdn.microsoft.com/en-us/library/ms752027.aspx

从MSDN: 默认情况下,可见的WindowsFormsHost元素总是绘制在其他WPF元素之上,并且不受z顺序的影响.要启用z顺序,请将WindowsFormsHost的IsRedirected属性设置为true,并将CompositionMode属性设置为Full或OutputOnly. 要查看默认的z顺序行为"

From MSDN: "By default, visible WindowsFormsHost elements are always drawn on top of other WPF elements, and they are unaffected by z-order. To enable z-ordering, set the IsRedirected property of the WindowsFormsHost to true and the CompositionMode property to Full or OutputOnly. To see the default z-order behavior"

将以下XAML复制到Grid元素中."

"Copy the following XAML into the Grid element."

<!-- Z-order demonstration. -->
<Canvas Grid.Row="1" Grid.Column="1">
  <WindowsFormsHost Canvas.Top="20" Canvas.Left="20" Background="Yellow">
    <wf:Button Text="Windows Forms control" FlatStyle="Flat"/>
  </WindowsFormsHost>
  <Label Content="A WPF label" FontSize="24"/>
</Canvas>

Press F5 to build and run the application. The WindowsFormsHost element is painted over the label element.

在IsRedirected为true时查看z顺序行为"

"To see the z-order behavior when IsRedirected is true"

Replace the previous z-order example with the following XAML.
XAML

<!-- Z-order demonstration. -->
<Canvas Grid.Row="1" Grid.Column="1">
  <WindowsFormsHost IsRedirected="True" CompositionMode="Full" Canvas.Top="20" Canvas.Left="20" Background="Yellow">
    <wf:Button Text="Windows Forms control" FlatStyle="Flat"/>
  </WindowsFormsHost>
  <Label Content="A WPF label" FontSize="24"/>
</Canvas>

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)

Microsoft .NET Framework 4.5 Beta Readme

1.3.10 Windows Presentation Foundation (WPF)

1.3.10.1 HwndHost功能已从.NET Framework 4.5 Beta中的WPF中删除

1.3.10.1 HwndHost feature has been removed from WPF in the .NET Framework 4.5 Beta

.NET Framework 4.5开发人员预览版包括WPF HwndHost重定向功能.但是,此功能 存在几个已知问题,并且已从.NET Framework 4.5 Beta中删除. .它将不会包含在任何将来的版本中.

The .NET Framework 4.5 Developer Preview included a WPF HwndHost redirection feature. However, this feature had several known issues and has been removed from the .NET Framework 4.5 Beta. It will not be included in any future releases.

要解决此问题:

没有解决方法.

(添加了重点)

这篇关于找不到WindowsFormsHost错误IsRedirected吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆