Creating a Dashboard with the Report Viewer Control and a Custom Overview View Type
Note: This blog post is intended for a developer audience, especially partners working on building extensions to Service Manager or customers looking to make advanced customizations to Service Manager.
In this guest blog post, Ryan Stolte who is the CTO and Founder of one of our partners, Bay Dynamics. is going to show how with a few lines of XAML to create a custom UserControl and some MP XML, you can create custom dashboards embedded in the Service Manager console. This example uses the Overview View Type in which you can put whatever XAML you want including custom controls. Lastly, I want to point out that because Ryan uses a Management Pack Bundle to package the solution, it is deployed seamlessly to all Service Manager consoles automatically when the MP is imported.
Thanks for writing this up Ryan! We're all excited about the IT Analytics solution you guys are putting together for Service Manager!
System Center Service Manager provides a core set of capabilities for organizations to implement an ITIL based service management program. As a part of any effective service management program, we need to measure our performance to understand what is happening now, how we're doing over time, and identify areas to improve.
Bay Dynamics offers IT Analytics™ software that helps organizations continuously measure and continuously improve their service management program through the use of strategic Key Performance Indicators, operational dashboards, and fast and flexible OLAP cubes that represent all core processes and configuration items in Service Manager.
SQL Server Reporting Services is a very capable reporting platform leveraged by both Service Manager and IT Analytics to deliver visually informative dashboards and reports to users. In this example, we will show how an organization can extend Service Manager by adding a dashboard oriented report to a context relevant location within the Service Manager Console.
Along the way, we'll demonstrate how to:
- Create a custom Overview View Type to host a WPF User Control and display it in the content area for a folder
- Create a WPF user control that hosts a Windows Forms based control
- Combine them all together to host the SSRS ReportViewer 2008 control to host a dashboard for your users, as shown below:
First, create a new WPF Application in Visual Studio to host our control. We will distribute this control within an assembly, so we need to change the output type to be a class library. Next, add a new WPF User Control to the project to host our SSRS Report. We'll add the content to our control through code, so the only change we'll make is to give the Grid a name, for convenient referencing later on, and remove the Height and Width to allow this control to fill the entire available area in the Service Manager Console.
< UserControl x. Class =" BayDynamics.Examples.IncidentDashboard. IncidentDashboardControl "
xmlns. x ="http://schemas.microsoft.com/winfx/2006/xaml">
< Grid x. Name ="thisReportGrid" />
</ UserControl >
Next we need to add our building blocks to this control. We want to use the SSRS Report Viewer control, so we need to ensure that this control is available to our development environment. Try adding a reference to Microsoft.ReportViewer.WinForms as shown below.
If the assembly isn't available in the list, you can download the Microsoft Report Viewer 2008 Redistributable from:
Note that you'll need to restart Visual Studio after you've installed the Report Viewer to see the new reference. In order to use the Report Viewer in our new control, we're going to use a WindowsFormsHost, so we also need to add references to System.Windows.Forms and WindowsFormsIntegration.
Now that we have all of our prerequisites in place, we can tie things together via code. First we create a WindowsFormsHost object and a ReportViewer object, and set the ReportViewer as a child of the WindowsFormsHost. Then we add our WindowsFormsHost object to the outermost grid defined in the XAML.
We then have a few lines of code that tell the Report Viewer that we'll be using a hosted report by setting the ProcessingMode to Remote, and give it the SSRS URL and path to the report we'd like to show. For a more reusable design, this control could be parameterized to pass in the SSRS URL and report name, but we'll hard code them in our example (don't forget to replace the <SERVERNAME> and <PATHTOREPORT> placeholders below). Finally, now that everything is connected, we ask the Report Viewer to refresh the report, which will cause it to actually render our dashboard.
public partial class IncidentDashboardControl. System.Windows.Controls. UserControl
public IncidentDashboardControl()Source: blogs.technet.com