WPF Report Designer - CTP (Coming soon in v15.1)

Thinking Out Loud
20 May 2015

Our upcoming release will include the first community technology preview of our new Report Designer for WPF. This designer ships with many of the features found in its WinForms counterpart and is fully compatible with all WPF design methodologies.

The following is a brief summary of the features we'll ship in this CTP....

  • Integrated Print Preview capable of pixel perfect document rendering
  • Integrated Report Explorer, Field List and Property Grid
  • A full-featured design surface for editing banded report layouts
  • Support for all DevExpress Report controls
  • Native support for Multiple Document Interface (MDI)
  • Support for Snap Lines and Snap Grid
  • Support for DevExpress WPF themes
  • Undo/Redo support

WPF Report Designer

In this beta, the WPF Report Designer will have the following limitations:

  • No report or data source wizard
  • No dedicated Expression Editor
  • No Filter Editor
  • No support for end-user scripting

With that brief intro, let's show you how you'd get started with the control. To add the Report Designer to a form, you can use the following XAML sample code:

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxreport="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner"
        xmlns:local="clr-namespace:WpfApplication1"
        Title="MainWindow" Height="350" Width="525">
<Grid>
    <dxreport:ReportDesigner x:Name="reportDesigner" DocumentSaved="reportDesigner_DocumentSaved"/>
</Grid>
</Window>


To open and save a report from code behind:

using DevExpress.XtraReports.UI;

// ...

public MainWindow() {

   InitializeComponent();

    reportDesigner.OpenDocument(yourReport);

}

void reportDesigner_DocumentSaved(object sender, DevExpress.Xpf.WpfReportDesigner.ReportDesignerDocumentEventArgs e) {

    XtraReport savedReport = e.Document.SourceReport;

    // Put your custom logic to save a report here.

}


If using MVVM, you need to implement a view model that provides access to a target report and handle changes as show below. Please note that at this point in time, this option allows you to specify a single report against which the Designer can operate.

using DevExpress.Mvvm;

using DevExpress.XtraReports.UI;

// ...

public class MainViewModel : BindableBase {

    public MainViewModel() {

        report = new XtraReport1();

    }

    XtraReport report;

    public XtraReport Report {

        get { return report; }

        set { SetProperty(ref report, value, () => Report, OnReportChanged); }

    }

    void OnReportChanged() {

        MessageBox.Show("Report Changed");

    }

}


Once this is completed, you will then bind to the view model’s Report property.

<Window x:Class="WpfApplication17.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxreport="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner"
        xmlns:local="clr-namespace:WpfApplication17"
        Title="MainWindow" Height="350" Width="525">
    <Window.DataContext>
        <local:MainViewModel />
    </Window.DataContext>
    <Grid>
        <dxreport:ReportDesigner x:Name="reportDesigner" SingleDocumentSource="{Binding Report, Converter={dxwrd:ReportDesignerDocumentSourceConverter}}" />
    </Grid>
</Window>

So there it is - our new WPF Report Designer. Tell us what you think about this new product...we want to hear your feedback. 

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.