Skip to main content

Add an End-User Report Designer to a WPF Application

  • 2 minutes to read

This document describes how to embed an End-User Report Designer into a WPF application and open the specified report:

  1. Open an existing reporting application or create a new application.
  2. In Visual Studio, open your WPF application’s MainWindow.xaml file.
  3. Switch to the Toolbox (press CTRL+ALT+X), expand the DX.23.2: Reporting tab, and drop the ReportDesigner control onto the Window.

    WPFDesigner_AddingDesignerToWindow

    This generates the following XAML code:

    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:dxrud="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner" x:Class="TestDesigner.MainWindow"
            Title="MainWindow" Height="350" Width="525">
        <dxrud:ReportDesigner HorizontalAlignment="Left" Margin="20,10,0,0" VerticalAlignment="Top"/>
    </Window>
    
  4. Right-click the Designer, select Layout, and then Fill All to fill the entire window.

    WPFDesigner_StretchingDesignerToWindow

  5. Go to the Properties grid and specify the Designer’s name.

    WPFDesigner_SpecifyingDesignerName

  6. Handle the Window’s Loaded event. In the event handler, pass the report you want to open in the Designer to the ReportDesigner.OpenDocument method.

    Note

    If you implement a custom report that inherits from XtraReport and want to open it in the End-User Report Designer, add a constructor without parameters to this report.

    private void Window_Loaded(object sender, RoutedEventArgs e) {
        // ...
        reportDesigner.OpenDocument(report);
    }
    
  7. Run the application to see the End-User Report Designer.

    If you want to display the End-User Report Designer with the previous ribbon version, set the ReportDesigner.UseOfficeInspiredRibbonStyle property to false as shown below.

    <dxrud:ReportDesigner x:Name="reportDesigner" UseOfficeInspiredRibbonStyle="False"/>
    

    WPFDesigner_CreatingDesignerResult

See Also