After working a bit with the Silverlight Report Viewer for Telerik Reporting, it seemed only natural to write a quick post to explain how exactly the Reporting WCF Service (located here in the help file) works and how to quickly and easily get started with it.
Now we understand the why, how about the how? In the most basic sense, getting set with the Reporting WCF service can be handled in a few easy steps:
You can actually see this entire process in action in the Getting Started with the Telerik Silverlight Report Viewer video on Telerik TV. But what if you want to go a little further? Thankfully, this WCF service is built to offer a bit more functionality than just pointing Reporting to a single report, and here's how...
First, you want to take advantage of the ReportServiceClient that is located in Telerik.Reporting.Service.SilverlightClient assembly. This allows you to get a list of reports that are available to the service. Once you have these, you can easily load them into the Silverlight Report Viewer. Here is a quick sample of code to show you how this is done:
MainPage : UserControl
sender, RoutedEventArgs e)
sender, ListAvailableReportsEventArgs e)
.MyReports = e.Reports;
// Decide which report to load, or place them into a RadComboBox to let the user select different reports!
.MyReports.Count > 0)
To run through what we're doing here, we first set up a ReportServiceClient to use, which in the Loaded event will be created based on the ReportService.svc that we already have generated. Once this is set, we call the ListAvailableReportsCompleted async method to grab a list of the reports available.
Once that returns back, we can populate the IList<ReportInfo> collection with the e.Reports result- each of these ReportInfo items contains both the regular name (useful for placing in a ListBox, RadComboBox, etc.), as well as the FullName, which is the fully qualified name that you can set to SilverlightReportViewer.Report to load your report. It really is as easy as that!
Stay tuned, next time we're going to go in-depth on how you can utilize the Reporting WCF service to stream report data to a few other Telerik controls so you can see some of the extra versatility of this service.
Evan Hutnick works as a Developer Evangelist for Telerik specializing in Silverlight and WPF in addition to being a Microsoft MVP for Silverlight. After years as a development enthusiast in .Net technologies, he has been able to excel in XAML development helping to provide samples and expertise in these cutting edge technologies. You can find him on Twitter @EvanHutnick.