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
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="WpfApplication17.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxwrd="http://schemas.devexpress.com/winfx/2008/xaml/wpfreportdesigner"
xmlns:local="clr-namespace:WpfApplication17"
Title="MainWindow" Height="350" Width="525">
<Grid>
<dxwrd:ReportDesignerControl 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;
// ...
publicclassMainViewModel : BindableBase {
public MainViewModel() {
report = newXtraReport1();
}
XtraReport report;
publicXtraReport 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:dxwrd="http://schemas.devexpress.com/winfx/2008/xaml/wpfreportdesigner"
xmlns:local="clr-namespace:WpfApplication17"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<local:MainViewModel />
</Window.DataContext>
<Grid>
<dxwrd:ReportDesignerControl 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.