# Generate a Grid-Based Report | WPF Controls | DevExpress Documentation

You can generate a Grid-based Report with the same data, appearance, and layout as in the displayed [GridControl](/WPF/DevExpress.Xpf.Grid.GridControl). End users can [customize](https://devexpress.github.io/dotnet-eud/reporting-for-desktop/articles/report-designer/report-designer-for-wpf.html) a Report appearance.

![](/WPF/images/wpf_grid_reportdesigner.png)

Note

You can generate a Grid-based Report only from the [TableView](/WPF/DevExpress.Xpf.Grid.TableView).

## Generate a Report at Runtime

The following example demonstrates how to initialize and open the [Report Designer](/XtraReports/114104/wpf-reporting/end-user-report-designer-for-wpf) in code. To use this example in your project, add references to the `DevExpress.Xpf.ReportDesigner.v26.1` and `DevExpress.XtraReports.v26.1` assemblies.

- C#
- VB.NET

<section id="tabpanel_yFYRiCkrdJ_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;,&quot;/ (System.Collections.ObjectModel)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.collections.objectmodel&quot;,&quot;/ (DevExpress.XtraReports.UI)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.XtraReports.UI&quot;,&quot;/ (DevExpress.Xpf.Grid.Printing)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Grid.Printing&quot;,&quot;/ (DevExpress.Xpf.Reports.UserDesigner)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Reports.UserDesigner&quot;}" class="lang-csharp">using System.Windows;
using System.Collections.ObjectModel;
using DevExpress.XtraReports.UI;
using DevExpress.Xpf.Grid.Printing;
using DevExpress.XtraExport.Helpers;
using DevExpress.Xpf.Reports.UserDesigner;

namespace DXGridSample {
    public partial class MainWindow : Window {
        ...
        void BarButtonItem_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
            ShowDesigner(tableView);
        }
        // Initializes and runs a Report Designer.
        public static void ShowDesigner(IGridViewFactory&lt;ColumnWrapper, RowBaseWrapper&gt; factory) {
            var report = new XtraReport();
            ReportGenerationExtensions&lt;ColumnWrapper, RowBaseWrapper&gt;.Generate(report, factory);
            ReportDesigner reportDesigner = new ReportDesigner();
            reportDesigner.Loaded += (s, e) =&gt; {
                reportDesigner.OpenDocument(report);
            };
            reportDesigner.ShowWindow(factory as FrameworkElement);
        }
    }
}
</code></pre></section>
<section id="tabpanel_yFYRiCkrdJ_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (System.Windows)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.windows&quot;,&quot;/ (System.Collections.ObjectModel)(?:;|$)/&quot;:&quot;https://learn.microsoft.com/dotnet/api/system.collections.objectmodel&quot;,&quot;/ (DevExpress.XtraReports.UI)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.XtraReports.UI&quot;,&quot;/ (DevExpress.Xpf.Grid.Printing)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Grid.Printing&quot;,&quot;/ (DevExpress.Xpf.Reports.UserDesigner)(?:;|$)/&quot;:&quot;/WPF/DevExpress.Xpf.Reports.UserDesigner&quot;}" class="lang-vb">Imports System.Windows
Imports System.Collections.ObjectModel
Imports DevExpress.XtraReports.UI
Imports DevExpress.Xpf.Grid.Printing
Imports DevExpress.XtraExport.Helpers
Imports DevExpress.Xpf.Reports.UserDesigner

Namespace DXGridSample
    Partial Public Class MainWindow
        Inherits Window
        ...
        Sub BarButtonItem_ItemClick(ByVal sender As Object, ByVal e As DevExpress.Xpf.Bars.ItemClickEventArgs)
            ShowDesigner(tableView)
        End Sub
        &#39; Initializes and runs a Report Designer.
        Public Shared Sub ShowDesigner(ByVal factory As IGridViewFactory(Of ColumnWrapper, RowBaseWrapper))
            Dim report = New XtraReport()
            ReportGenerationExtensions(Of ColumnWrapper, RowBaseWrapper).Generate(report, factory)
            Dim reportDesigner As New ReportDesigner()
            AddHandler reportDesigner.Loaded, Sub(s, e) reportDesigner.OpenDocument(report)
            reportDesigner.ShowWindow(TryCast(factory, FrameworkElement))
        End Sub
    End Class
End Namespace
</code></pre></section>

## Use Behaviors to Generate a Report

To initialize and open the [Report Designer](/XtraReports/114104/wpf-reporting/end-user-report-designer-for-wpf) in XAML:

1. Add reference to the `DevExpress.Xpf.ReportDesigner.v26.1` assembly.
2. Attach the [GridReportManagerService](/WPF/DevExpress.Xpf.Reports.UserDesigner.Extensions.GridReportManagerService) to a [TableView](/WPF/DevExpress.Xpf.Grid.TableView).
3. Attach the [ReportManagerBehavior](/WPF/DevExpress.Xpf.Reports.UserDesigner.Extensions.ReportManagerBehavior) to a ribbon or bar item.
4. Bind the [ReportManagerBehavior](/WPF/DevExpress.Xpf.Reports.UserDesigner.Extensions.ReportManagerBehavior)**.Service** property to [GridReportManagerService](/WPF/DevExpress.Xpf.Reports.UserDesigner.Extensions.GridReportManagerService).

[View Example: Use the GridReportManagerService to Implement the Report Management Functionality](https://github.com/DevExpress-Examples/wpf-data-grid-use-gridreportmanagerservice-to-implement-report-management-functionality)

- XAML

<section id="tabpanel_yFYRiCkrdJ-1_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;Window 
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; 
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; 
    xmlns:dxg=&quot;http://schemas.devexpress.com/winfx/2008/xaml/grid&quot; 
    xmlns:dxb=&quot;http://schemas.devexpress.com/winfx/2008/xaml/bars&quot; 
    xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
    xmlns:dxrudex=&quot;http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesignerextensions&quot; 
    x:Class=&quot;DXGridSample.MainWindow&quot;
    Title=&quot;MainWindow&quot; 
    Height=&quot;350&quot; Width=&quot;525&quot;&gt;
    &lt;DockPanel&gt;
        &lt;dxb:ToolBarControl DockPanel.Dock=&quot;Top&quot; &gt;
            &lt;dxb:BarSplitButtonItem Glyph=&quot;{dx:DXImage Image=Print_16x16.png}&quot;&gt;
                &lt;dxmvvm:Interaction.Behaviors&gt;
                    &lt;dxrudex:ReportManagerBehavior Service=&quot;{Binding ElementName=reportManagerService}&quot;/&gt;
                &lt;/dxmvvm:Interaction.Behaviors&gt;
            &lt;/dxb:BarSplitButtonItem&gt;
        &lt;/dxb:ToolBarControl&gt;
        &lt;dxg:GridControl x:Name=&quot;grid&quot; AutoGenerateColumns=&quot;AddNew&quot;&gt;
            &lt;dxg:GridControl.View&gt;
                &lt;dxg:TableView x:Name=&quot;view&quot;&gt;
                    &lt;dxmvvm:Interaction.Behaviors&gt;
                        &lt;dxrudex:GridReportManagerService x:Name=&quot;reportManagerService&quot; /&gt;
                    &lt;/dxmvvm:Interaction.Behaviors&gt;
                &lt;/dxg:TableView&gt;
            &lt;/dxg:GridControl.View&gt;
        &lt;/dxg:GridControl&gt;
    &lt;/DockPanel&gt;
&lt;/Window&gt;
</code></pre></section>

## Limitations

- If the [GridControl](/WPF/DevExpress.Xpf.Grid.GridControl) works in master-detail mode, only the master View is displayed in the **Report Designer**. Users can manually add detail rows to the Report.
- The [merged grid cells](/WPF/17776/controls-and-libraries/data-grid/appearance-customization/cell-merging) are exported as separate cells.
- Custom grouping, sorting, and summaries are not applied to the Report.
- The report displays [summaries](/WPF/6128/controls-and-libraries/data-grid/data-summaries/total-summary) from the top summary panel below data rows.

See Also

[Print Data](/WPF/6160/controls-and-libraries/data-grid/printing-and-exporting/print-data)