# Load Reports

This topic explains how to load and display a report using the Viewer control in a WPF application.

## Content



To load and display a report using the Viewer control in a WPF application,

1.  Create a new a WPF application in Visual Studio.
2.  From the Visual Studio toolbox, drag the **Viewer** control onto your XAML Form.
3.  Set the viewer's **Dock** property to **Fill** to show the complete Viewer control on the Form.
4.  In the Solution Explorer, select the report you have created and from the Properties window, set **Copy to Output Directory** to **Copy Always**.<br />
5.  On MainWindow.xaml, with the viewer selected, go to the Properties window and double click the Loaded event.
6.  In the MainWindow code view that appears, add code like the following to the viewer1\_loaded event to bind the report to the viewer. This code shows an .rdlx report being loaded, but you can use an .rpx report as well.
    
    ```vbnet
    Viewer1.LoadDocument("rptSingleLayout.rdlx")
    ```

    ```csharp
    viewer1.LoadDocument("rptSingleLayout.rdlx");
    ```
> type=note
> **Note**: If Page/RDLX report is selected from dropdown of Source property (containing relative path), 'Copy to Output Directory' for selected report should be set as 'Copy always/Copy if newer' otherwise error "Could not find file ... " appears on loading WPF Viewer.<br />

> type=warning
> **Caution**: In WPF Viewer control, previewing code-based Section reports using [Source](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Viewer.Wpf/GrapeCity.ActiveReports.Viewer.Wpf.Viewer.html) and [SourceFormat](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Viewer.Wpf/GrapeCity.ActiveReports.Viewer.Wpf.Viewer.html) properties is not supported.

> type=note
> **Note**:
> 
> *   Refer to the [LoadDocument](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Viewer.Wpf/GrapeCity.ActiveReports.Viewer.Wpf.Viewer.html) method to see other ways to load a report in WPF Viewer.
> *   We can set report for WPFViewer directly on XAML file and load the report in WPF Viewer using [Source](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Viewer.Wpf/GrapeCity.ActiveReports.Viewer.Wpf.Viewer.html) and [SourceFormat](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Viewer.Wpf/GrapeCity.ActiveReports.Viewer.Wpf.Viewer.html) properties.
> *   To avoid evaluation banners appearing at run time, license your ActiveReports WPF Application project. You can find information on licensing in [License Your ActiveReports](/activereportsnet/docs/v19.2/developers/ar-how-licensing-activereports).

## See Also

#### Samples

[WPF Viewer](/activereportsnet/docs/v19.2/samples/samples-ar/desktop-sample/wpf-viewer-sample)
