在使用MVVM的WPF应用程序中使用SSRS报表查看器的最佳方法是什么

Ema*_*iel 8 wpf mvvm reporting-services

我有一个使用MVVM的WPF应用程序.我有一些用户控件在Windows窗体主机控件中托管的ReportViewer控件中显示一些SSRS报告.

用户控件具有简单的组合框,其中用户选择标准,因此将加载满足该标准的报告,从数据库获取其数据,然后向用户显示报告.

使用MVVM在WPF中实现此类场景的最佳方法是什么?任何样品都非常感谢

Edu*_*eni 7

看看这个答案

他正在ViewModel中创建WindowsFormsHostReportViewer

WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
reportViewer = new ReportViewer();
windowsFormsHost.Child = reportViewer;
this.Viewer = windowsFormsHost
Run Code Online (Sandbox Code Playgroud)

然后使用ContentPresenter显示它

<ContentPresenter Content="{Binding Viewer}" />
Run Code Online (Sandbox Code Playgroud)