我将把ReportViewer放在WindowsFormsHost中,开始在WPF应用程序中使用MS ReportViewer.
这是正确的方法吗?设计报告的最佳方法是什么,因为在WindowsFormsHost中无法在设计时使用ReportViewer.
最好在SQL Server中创建RDL报告,然后将其转换为RDLC,或者创建新的Winforms应用程序以在WinForms框架中创建RDLC文件,然后将其复制到WPF应用程序.
我需要通过下拉列表过滤报告,因此也需要考虑这个方面.如果有人已经在WPF中使用ReportViewer,我会很感激对最佳方法的一些反馈.....非常感谢.
小智 25
是的,这是有效的,我在wpf项目中使用WindowsFormsHost来包装ReportViewer.
在ViewModel中,我创建了WindowsFormsHost和ReportViewer:
WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
reportViewer = new ReportViewer();
windowsFormsHost.Child = reportViewer;
this.Viewer = windowsFormsHost
Run Code Online (Sandbox Code Playgroud)
在视图中我通过绑定到包含WindowsFormsHost的Property来使用ContentPresenter来显示它.
<ContentPresenter Content="{Binding Viewer}" ...
Run Code Online (Sandbox Code Playgroud)
我们正在使用Business Intelligence Studio(带有用于编辑报表的模板的Visual Studio 2008)来创建报表.http://msdn.microsoft.com/en-us/library/ms173767.aspx
小心,
马丁
Mat*_*ton 23
我们肯定只使用WindowsFormsHost取得了成功.我自己并没有参与创建RDLC文件,但我相信它们是在WinForms项目中设计的(正如你所说),然后被复制.
请注意,如果您不需要本地报告,则可以使用WPF Frame控件并将其指向基于服务器的报告的URL(它将其呈现为Web浏览器).这对我们来说也很有效.
| 归档时间: |
|
| 查看次数: |
26620 次 |
| 最近记录: |