.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

How to: Use the Custom Report Preview Form

  • 2 minutes to read

This example demonstrates how to show a custom Report Preview form by handling the ReportServiceController.CustomShowPreview event.

In this topic, it is assumed that you have an XAF application that uses the Reports V2 Module, and you have created one or more reports (see Reports V2 Module Overview).

Use the following Controller to display a report preview in a custom window (the CustomPreviewForm form, in this example).

using DevExpress.XtraReports.UI;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.ReportsV2;
// ...
public class CustomPreviewController : ViewController {
    private ReportServiceController reportServiceController;
    protected override void OnActivated() {
        reportServiceController = Frame.GetController<ReportServiceController>();
        if (reportServiceController != null) {
            reportServiceController.CustomShowPreview += reportServiceController_CustomShowPreview;
    void reportServiceController_CustomShowPreview(object sender, CustomShowPreviewEventArgs e) {
        IReportContainer reportContainer = 
            e.ParametersObject, e.Criteria, e.CanApplyCriteria, e.SortProperty, e.CanApplySortProperty);
        CustomPreviewForm form = new CustomPreviewForm();
        e.Handled = true;
    protected override void OnDeactivated() {
        if (reportServiceController != null) {
            reportServiceController.CustomShowPreview -= reportServiceController_CustomShowPreview;

The CustomPreviewForm form can be designed as described in the following tutorials:

When the CustomPreviewForm is ready, add the ShowReport method to it.

public void ShowReport(XtraReport report){
    documentViewer1.DocumentSource = report;

In this example, documentViewer1 is the DocumentViewer component added to the current form.


Refer to the API and Customization section in the XtraReports documentation to learn more about report preview customization.