我将通过将 ReportViewer 放置在 WindowsFormsHost 中来开始在 WPF 应用程序中使用 MS ReportViewer。
这是正确的方法吗?设计报表的最佳方法是什么,因为您无法在设计时在 WindowsFormsHost 中使用 ReportViewer。
最好在 SQL Server 中创建 RDL 报告,然后将其转换为 RDLC,或者创建一个新的 Winforms 应用程序,在 WinForms 框架中创建 RDLC 文件,然后将其复制到 WPF 应用程序。
我需要通过下拉菜单过滤报告,因此也需要考虑这一方面。如果有人已经在 WPF 中使用 ReportViewer,我将不胜感激一些有关最佳方法的反馈......非常感谢。
是的,这有效,我在 wpf 项目中使用 WindowsFormsHost 来包装 ReportViewer。
在 ViewModel 中,我创建 WindowsFormsHost 和 ReportViewer:
WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
reportViewer = new ReportViewer();
windowsFormsHost.Child = reportViewer;
this.Viewer = windowsFormsHost
在视图中,我通过绑定到保存 WindowsFormsHost 的属性,使用 ContentPresenter 来显示它。
<ContentPresenter Content="{Binding Viewer}" ...
我们使用 Business Intelligence Studio(这是一个 Visual Studio 2008,带有用于编辑报告的模板)来创建报告。http://msdn.microsoft.com/en-us/library/ms173767.aspx http://msdn.microsoft.com/en-us/library/ms173767.aspx
小心,
Martin
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)