Display SSRS RDL report in Bold Reports® WPF Report Viewer

To display an already created SSRS RDL report in the Bold Reports® WPF Report Viewer without using a Report Server, create a WPF application, install the BoldReports.Wpf NuGet package, and set the ReportPath property.

To create your first application on the other .NET Frameworks lower than 4.6.2, refer to the documentation for creating a WPF application in .NET Framework 4.6.

Create the application project

  1. Start Visual Studio 2022 and click Create new project.
  2. Select WPF App (.NET Framework), and then click Next. WPF application project template
  3. Change the project name, choose .NET Framework 4.6.2 or Higher in the framework field, and then click Create. WPF application version template

How do I add the Report Viewer to a WPF app?

You add the Bold Reports® WPF Report Viewer to a WPF app by installing the BoldReports.Wpf NuGet package through Manage NuGet Packages.

  1. Right-click the project or solution on the Solution Explorer tab, and choose Manage NuGet Packages. Alternatively, select Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

    Refer to the NuGet Packages to learn more details about installing and configuring Report Viewer NuGet packages.

  2. Search for BoldReports.Wpf NuGet package, and install them in your WPF application.

    Package Purpose
    BoldReports.Wpf Contains WPF Reporting controls (Report Viewer and Report Writer) to preview and export the reports.

Initialize Report Viewer

  1. Import the Report Viewer namespace in the MainWindow.xaml file.

    xmlns:syncfusion="clr-namespace:BoldReports.UI.Xaml;assembly=BoldReports.Wpf"
  2. Initialize the Report Viewer component inside the <Grid> tag in the MainWindow.xaml file.

    <Window
        .....
        .....
        .....
        .....
        xmlns:syncfusion="clr-namespace:BoldReports.UI.Xaml;assembly=BoldReports.Wpf"
        .....
        .....>
        <Grid>
            <syncfusion:ReportViewer Name="reportViewer" />
        </Grid>
    </Window>

Add already created reports

The Report Viewer is only for rendering reports. You must use a report generation tool to create a report. To learn more about this, refer to the create RDL report section.

  1. Create a folder Resources in your application to store the RDL reports.

  2. Add already created reports to the newly created folder.

    In this tutorial, the sales-order-detail.rdl report is used, and you can download the sales-order-detail.rdl sample report. You can add the reports from the Syncfusion® installation location. For more information, refer to the samples and demos section.

  3. Set the Build Action to content and Copy to Output Directory to either Copy always or Copy if newer. Build action template

How do I set the report path for the Report Viewer in a WPF app?

You display a report in the Bold Reports® WPF Report Viewer by setting its ReportPath property in the MainWindow.xaml.cs file.

  1. Open the MainWindow.xaml.cs file.

  2. Initialize the window loaded event inside the MainWindow() constructor.

    public MainWindow()
    {
        InitializeComponent();
        this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
    }
    
    private void MainWindow_Loaded(object sender, RoutedEventArgs e)
    {
    }
  3. Set the ReportPath property in the MainWindow_Loaded event and invoke the RefreshReport() method to render the report.

  4. You can replace the following code in your MainWindow_Loaded event method.

    private void MainWindow_Loaded(object sender, RoutedEventArgs e)
    {
        this.reportViewer.ReportPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\sales-order-detail.rdl");
        this.reportViewer.RefreshReport();
    }

Preview the report

Build and run the application to view the report output in the WPF Report Viewer, as displayed in the following screenshot:

Preview of sales order detail report

To see more features, refer to the WPF Report Viewer feature tour page.

See Also

Create RDLC report

Create WPF application in .NET Framework 4.6

Migrate Report Viewer

List of SSRS server versions are supported in Bold Reports®