Infragistics (R) NetAdvantage(R) Reporting
Using the XAML Report Viewer
Send Feedback

Glossary Item Box

Topic Overview


This topic introduces the basics for using the XAML Report Viewer control.

In this topic

This document contains the following sections:

Adding the Report Viewer


This procedure shows you how to add the Report Viewer to your SL/WPF application.


Following is a conceptual overview of the process:

  1. Adding the Report Viewer by Drag-and-Drop
  2. Adding the Report Viewer by adding a tag to XAML code


  1. Add the Report Viewer by Drag-and-Drop.

    In the MainPage.xaml file, drag and drop the XamReportViewer control from the Report Toolbox to the XAML Design View. This will automatically add a reference to required assemblies (e.g. InfragisticsSL4.Controls.Reports in Silverlight) and a default namespace for using NetAdvantage Reporting controls. The report viewer tag is also automatically added in the XAML code (i.e. <ig:XamReportViewer/>).

  2. Add the Report Viewer by Adding a Tag to the XAML Code.

    In XAML:

    <igReports:XamReportViewer Name="xamReportViewer1" 
    Margin="0,130,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />

    Note: You need to add a namespace (to make report controls available in the code editor) and a reference in your Application to the required assemblies (e.g. In Silverlight: InfragisticsSL5.Controls.Reports). For example, xmlns:ig=

    After the Report Viewer has been added, the code should look as in the example below.

    In XAML:

    <UserControl x:Class="ReportSample.MainPage"
        d:DesignHeight="300" d:DesignWidth="400" 
    xmlns:ig="" >
        <Grid x:Name="LayoutRoot">
           <ig:XamReportViewer Name="xamReportViewer1" Margin="0,130,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />

Assigning Reports

To assign a report means to indicate in the properties of the Report Viewer control the report to be displayed, and, in server-side rendering scenarios, the service that will be providing it. To do this, you need to specify the following properties using the Properties Panel or the code editor.

Note: The ServiceEndpointUri is required only for server-side rendering.

Working with a stream

When working on the client-side, Client render settings include a property named DefinitionStream.

The example below assumes you are binding to View Model and have a property (reportStream) returning a stream.


<ig:XamReportViewer Name="xamReportViewer1">
    <ig:ClientRenderSettings DefinitionStream="{Binding ReportStream}"/>                 

First open and read the stream, then you assign it to the RenderSettings property of your Report Viewer.

In C#:

ClientRenderSettings renderSettings = new ClientRenderSettings();
renderSettings.DefinitionStream = File.OpenRead(@"C:\Reports\Report.igr");
myViewer.RenderSettings = renderSettings;

Note: Once used, the stream is automatically disposed of by the viewer.

Binding to a Data Source

You can configure Report Data Sources directly in your XAML code by adding the DataSource tag. The following code sample shows how to bind data to a target data source (Orders) defined in the report.


<ig:XamReportViewer HorizontalAlignment="Right" Margin="0,78,0,0" Name="xamReportViewer1" VerticalAlignment="Top">
    <ig:ClientRenderSettings DefinitionUri="ReportLibrary;component/MyReport.igr, ReportLibrary" >                 
        <ig:DataSource TargetDataSource="Orders" ItemsSource="{Binding ElementName=domainDataSource}" />                   

Binding Report Parameters

You can bind or set parameter values directly in your XAML code by using the parameter tag. The following code sample shows how to set the value (myvalue) of a report parameter named “parameter1”.


<ig:XamReportViewer HorizontalAlignment="Right" Margin="0,78,0,0" Name="xamReportViewer1" VerticalAlignment="Top">
    <ig:ClientRenderSettings DefinitionUri="ReportLibrary;component/MyReport.igr" >                  
        <!-- Seting parameter value -->
        <ig:Parameter ParameterName="parameter1" ParameterValue="myvalue"/>

Related Topics

©2012. All Rights Reserved.