Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add rdlc file to ReportViewer in WPF projects

I've added a ReportViewer in a WPF app via the XAML designer of my main window and I'd like to add an existing rdlc file to it.

I'd like my reportviewer to show an empty rdlc file (without the parameters) on startup, and later upon selecting a row from my datagrid (bound to an observablecollection) change its parameters accordingly and show the filled report definition instead of the empty one.

I'll make a button with the selected row as commandparameter and the relevant events and everything, I just need to be able to pass data to the report. I realize it is not an easy question so I'll try to simplify:

  1. How to add an existing rdlc file to a ReportViewer (MVVM, WPF) ?
  2. I push a button -> relevant command gets the item from my observablecollection as parameter (a row in my datagrid) -> How to pass the data parts of this item to the unfilled (or overwrite if filled of course) parts of the report?

I hope I've been clear. Thanks for the answer in advance!

like image 850
Gábor Birkás Avatar asked Jul 17 '13 20:07

Gábor Birkás


People also ask

What is Rdlc Report in WPF?

RDLC stands for Report Definition Language Client Side. It is used to create reports the with the in-built services provided by Microsoft. Initially, RDLC was used in just web applications but presently, it can be used in both, web and desktop applications.

How do I add a dataset to Rdlc?

To create a dataset for the RDLC report, click Reporting under Visual C# Items. Click Report, and then click Add. The Report Wizard opens. Enter a dataset name in Name field.To choose a data source for the dataset, click New on the right of Data source drop-down combo box.


1 Answers

A was developing somethink like that a couple of months ago. However it's to much code to post here but have a look at this its completed sample with source Code. Advanced-Report-Viewver Codeproject

like image 66
Labrinths Avatar answered Nov 04 '22 08:11

Labrinths