13 Answers, 1 is accepted
The attached demo project illustrates a possible MVVM scenario, in which the report is changed on button click command.
The demo is cratered with the latest available Telerik Reporting version Q2 2014 version 22.214.171.124.618 and Telerik UI for WPF Q2 2014 version 2014.2.617.40.
Additional details about the WPF ReportViewer and the changes in Q2 2014 are available in the following articles:
I hope this helps you.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I just downloaded the demo version of Telerik report, having issues getting started with it.
Thanks for the example but I get a build error:
Error1The type reference cannot find a public type named 'RadRangeControl'. Line 595 Position 78
The error is caused by mismatching versions of Telerik Reporting and Telerik UI for WPF assemblies and XAML resources. The dependencies between Telerik Reporting and Telerik UI for WPF are listed in Upgrade Path Q2 2015.
Please test to re-add all assemblies manually from the local examples folder, and all XAML resources from the Wpf folder. More details where resources are located are available in How to: Add report viewer manually to a WPF application.
General upgrade instructions if you have both Telerik Reporting and Telerik UI for WPF:
- Get Telerik Reporting assemblies from C:\Program Files (x86)\Telerik\Reporting Q2 2015\Bin;
- Get Telerik.ReportViewer.Wpf.xaml from C:\Program Files (x86)\Telerik\Reporting Q2 2015\Wpf\Themes;
- Get Telerik UI for WPF assemblies from C:\Program Files (x86)\Telerik\UI for WPF Q2 2015\Binaries.NoXaml;
- Get the corresponding XAML files (without Telerik.ReportViewer.Wpf.xaml) from C:\Program Files (x86)\Telerik\UI for WPF Q2 2015\Themes.Implicit;
Thank you for your reply,
The installed version of Telerik for UI WPF that we recently purchased is V 2015.2.623.45
According to one your links it states that: "The viewer is build with Telerik UI Controls for WPF 2015.2.623.40. If you are using a newer version consider adding binding redirects. For more information see: How to: Add report viewer to a WPF application"
Please tell me the steps I have to do to downgrade the UI for WPF, I don't know what you mean when you say consider adding binding redirects... I have followed the links you sent and completed the steps, still I cannot get a new, simple, basic project built!
I followed all of your instructions on the MVVM sample and still I get
Error 1 Unknown build error, 'Cannot resolve dependency to assembly 'Telerik.Windows.Data, Version=2015.2.623.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. Line 9936 Position 203.'
The error indicates that the application tries to load the Telerik UI for WPF version used to build the WPF ReportViewer control, where your application has references to Telerik UI for WPF v2015.2.623.45.
Thus you need to add binding redirects for Telerik UI for WPF assemblies - check Binding Redirects section in How to: Add report viewer manually to a WPF application.
I finally got it to build, I didn't have the Telerik.Windows.Data v40 on the referenced list, I forgot to re-reference after removing all Telerik references in reporting and UI.
Thanks for your help, now I have to learn how to use this in an MVVM framework.
I'm trying to understand the demo project and wondering how to bind the report source to a gridview control which will be updated periodically in the view. The example uses a bind to MyReportSource, can you describe how to configure this? I have used the report viewer using an SQL datasource but I set that up at design time. Can you point me to a resource for instance binding to a gridview?
Thanks for your help.
I built a separate lib and project with the Report, included all of the v40 references and it built and I could play with ReportViewer.
Now I have to merge it into our master project which uses Telerik WPF UI V45 dlls. So I followed your link and instructions to Binding Redirects and I'm unclear what the instructions are asking me to do.
The main project's app.config does not have any <runtime> <assemblyBinding...> <dependentAssembly> sections, do I add these??
In the project with the WPF ReportViewer you can use Telerik UI for WPF version common for the application, where you need to add binding redirects to specify that you are using version with greater number than the version used in the WPF ReportViewer - Redirecting Assembly Versions (msdn).
Visual Studio may not add the binding redirects automatically, which means you need to do it manually.
About using the WPF ReportViewer in an MVVM scenario, only dependencies properties of the viewer control (designed for WPF technology) can be bound to properties of the model. Thus your model can have a ReportSource property bound to the viewer's ReportSource.
If you need to change the data in the report, on changing data in the grid control you can update a report's DataSource in code and then the model's ReportSource in order to refresh the viewer.
Thank you for the help on the binding redirects, I think it is working now, I was not adding the correct dependencies in the project.
Now that I'm finally working with the report viewer inside our master project the need to get data bound from the gridview is very much a priority for me. I'm still new to WPF but I want to make sure I understand your reply,
* My ViewModel will have a MydataSource property
* I have one reportviewer that needs the reflect the data from two gridviews and a radchart control. For now I want to be comfortable getting data from just one of the gridviews so I should new a MydataSource on the event of the gridview changing? I will do this in code in the ViewModel?
I am uncertain about the exact scenario.
In general, the idea is to detect when data is modified and get it, then trigger a change of the model's ReportSource property (update the report and its DataSource, and then wrap the modified report instance in a Report Source object). The change of the model's ReportSource will be transferred to the viewer's ReportSource as they will be bound to each other.
If you need further help, feel free to use the support ticketing system and send us a demo project to check your settings.