rozon
rozon

Reputation: 2538

Report Viewer (rdcl) in MVVM scenario

I'm about to start making some reports in my application, and I'm not sure where to start. I have an client app with Prism and MVVM that communicates with an WCF service and EF4.1 and SQL in the back.

How do I get the report designer to support a ViewModel?

Any good examples would be appreciated.

Edit: I have an basic understanding on how to do this, but it's not a good one and I hope for a better solution that might help...

Upvotes: 6

Views: 2063

Answers (2)

Scott Willeke
Scott Willeke

Reputation: 9345

In ActiveReports you can bind a report to a collection of objects (see ListDataSource), you can also take control of the data binding with ActiveReports unbound mode. Those aren't exactly what you're after but it will let you bind to any object including a ViewModel (just put the ViewModel in a single-element array or use unbound mode).

Scott Willeke
GrapeCity

Upvotes: 0

JanW
JanW

Reputation: 1849

There is no way to support features like Binding to a ViewModel on ReportViewer Control, since it is a WinForms control.

To handle the report viewer we use an interface, which is implemented by the View, which hosts the ReportViewer. The ViewModel has a property for this interface an can communicate directly with the ReportViewer to set the ServerReport path, credentials and parameters. Report parameters are provided as usual properties in the viewmodel, which on update also set the properties on the ReportViewer.

Upvotes: 3

Related Questions