WPF Grid-Based Report Generation (Coming soon in v15.2)

Thinking Out Loud
13 November 2015

In our never-ending quest to make reporting easier (and more flexible) for developers and end-users alike, v15.2 will introduce a new WPF Grid-based report generation option. As you can see from the screenshot below, this new option gives your power users a way to customize output and hopefully go a long way to reducing the number of custom reports you'll have to create over the life of your app.

WPF Grid-based Report Generation

With just a few lines of code, you can invoke the DevExpress WPF Report Designer at runtime from the Grid Control and create reports based on its data.

public static void ShowDesigner(IGridViewFactory<ColumnWrapper, RowBaseWrapper> factory)    {
    var report = new XtraReport();
    ReportGenerationExtensions<ColumnWrapper, RowBaseWrapper>.GenerateFrom(report, factory);
    var reportDesigner = new ReportDesigner();
    reportDesigner.Loaded += (s, e) =>    {
        reportDesigner.OpenDocument(report);
    };
    reportDesigner.ShowWindow(factory as FrameworkElement);
}

To make things as easy as possible, we've added two behaviors that allow you to incorporate Grid-based report generation in your app when using our WPF Ribbon control:

  • DevExpress.Xpf.Reports.UserDesigner.Extensions.ReportManagerBehavior
  • DevExpress.Xpf.Reports.UserDesigner.Extensions.GridReportManagerService.

Here's how it works...first, attach the GridReportManagerService to a TableView:

xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxrudex="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesignerextensions"
<!---->
<dxg:GridControl ... >
    <dxg:GridControl.View>
        <dxg:TableView ... >
           <dxmvvm:Interaction.Behaviors>
               <dxrudex:GridReportManagerService x:Name="CourseCollectionViewReportService" />
           </dxmvvm:Interaction.Behaviors>
        </dxg:TableView>
    </dxg:GridControl.View>
</dxg:GridControl>

...then attach ReportManagerBehavior to a Ribbon item and bind its Service property to GridReportManagerService:

xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxrudex="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesignerextensions"
<!---->
<dxr:RibbonControl ... >
    <!---->
    <dxb:BarSplitButtonItem ... >
        <dxmvvm:Interaction.Behaviors>
            <dxrudex:ReportManagerBehavior Service="{Binding ElementName=CourseCollectionViewReportService}" />
        </dxmvvm:Interaction.Behaviors>
    </dxb:BarSplitButtonItem>
    <!---->
</dxr:RibbonControl>

WPF Grid-based Report Generation

=========================

We'd love to hear your thoughts on these new features. Let us know what you think.




5 comment(s)
NHIF
NHIF

Things are all good with wpf ,windows forms and asp.net.

How do you consider us DevExtreme users?

13 November, 2015
Alex Boston
Alex Boston

Always want such feature, Hope We can see it XAF aslo with grid grouping

14 November, 2015
Alex Boston
Alex Boston

Always wanted this feature, Also How about grouping in grid mapped to a grouping in report also.

Can we get it in xaf web and xaf win ?

14 November, 2015
Dennis (DevExpress Support)
Dennis (DevExpress Support)

@Alex Boston: Thanks for your suggestion. Our team will take it into account.

20 November, 2015
Stefano S.
Stefano S.

Very interesting.

Thanks.

23 November, 2015

Please login or register to post comments.