Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to use a SSRS report viewer in a WPF application using MVVM

I have a WPF application using MVVM. I have some user controls that show some SSRS reports in a ReportViewer control hosted within a windows forms host control.

The User Control has a simple combobox where the user selects a criteria and therefore the report satisfying this criteria will be loaded, its data fetched from the database and then the report is shown to the user.

What is the best approach to implement such scenario in WPF using MVVM? Any samples are greatly appreciated

like image 204
Emad Gabriel Avatar asked Jul 25 '09 21:07

Emad Gabriel


2 Answers

Look at this answer

He is creating the WindowsFormsHost and ReportViewer in the ViewModel

WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
reportViewer = new ReportViewer();
windowsFormsHost.Child = reportViewer;
this.Viewer = windowsFormsHost

and then using a ContentPresenter to display it

<ContentPresenter Content="{Binding Viewer}" />
like image 184
Eduardo Molteni Avatar answered Oct 19 '22 02:10

Eduardo Molteni


this article works

https://msdn.microsoft.com/es-es/library/hh273267.aspx?f=255&MSPPError=-2147217396

and this video too

https://www.youtube.com/watch?v=_b33iGYMSfY

hope help

like image 34
KillemAll Avatar answered Oct 19 '22 02:10

KillemAll