我正在尝试从我的 WPF 应用程序创建一个弹出窗口,其中显示托管在 WindowsFormsHost 中的报表查看器 但是我在使用以下 Xaml 时遇到问题
<Page x:Class="FIS3.ReportViewer.ReportViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
Title="MapViewer">
<Grid>
<my:WindowsFormsHost>
</my:WindowsFormsHost>
<Label Name="exampleText" Content="this is the Report Viewer ..." />
</Grid>
我收到一个构建错误,通知我 “未找到类型‘my:WindowsFormsHost’。请验证您是否缺少程序集引用,并且所有引用的程序集均已构建”
我的 XAML 中是否犯了错误 我已添加 WindowsFormsIntegration 作为对我的项目的引用。
感谢您的帮助
栏
最佳答案
人们似乎忽视了第二种解决方案。我为这个问题挠了足足 20 分钟。没有一种解决方案,包括这个解决方案,是行得通的。事实证明我的解决方案是添加:
WindowsForms集成
我的引用资料
当我意识到基于:
http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx
这使用了 WindowsFormsIntegration.dll。我的引用文献中似乎缺少它。
希望这有帮助!
关于wpf - 使用 WindowsformsHost 将报表查看器插入 WPF 应用程序时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2100660/