How to: Use the Custom WinForms Report Designer
- 2 minutes to read
This example demonstrates how to use the custom Report Designer form by handling the WinReportServiceController.CreateCustomDesignForm 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).
Create a View Controller in the WinForms module project (MySolution.Module.Win). If your solution does not contain this project, add the Controller to the WinForms application project (MySolution.Win). Override the Controller’s OnActivated method, access the WinReportServiceController using the Frame.GetController<ControllerType> method and subscribe to the WinReportServiceController.CreateCustomDesignForm event.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.ReportsV2.Win;
using DevExpress.XtraReports.UserDesigner;
// ...
public class CustomDesignerController : ViewController {
private WinReportServiceController winReportServiceController;
protected override void OnActivated() {
base.OnActivated();
winReportServiceController = Frame.GetController<WinReportServiceController>();
if (winReportServiceController != null) {
winReportServiceController.CreateCustomDesignForm +=
delegate(object sender, CreateCustomDesignFormEventArgs e) {
e.DesignForm = new XRDesignRibbonForm();
};
}
}
}
In the code above, the built-in XRDesignRibbonForm is used instead of the default XRDesignForm. You can create a custom form from scratch based on the Creating a Custom End-User Report Designer document and use it instead.