XRDesignPanel.DesignerHostLoaded Event
Occurs after the designer host is activated for a report currently being edited in the current Design Panel.
Namespace: DevExpress.XtraReports.UserDesigner
Assembly: DevExpress.XtraReports.v19.1.Extensions.dll
NuGet Package: DevExpress.Win.Reporting
Declaration
Event Data
The DesignerHostLoaded event's data class is DesignerLoadedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
DesignerHost | Gets the designer host which provides all the services that are available for editing a report in its End-User Designer. |
Remarks
Use the DesignerHostLoaded event, to perform particular actions (for instance, customize the designer’s Toolbox), after all initialization has been performed (all the hosts and services required by the End-User Designer have been initialized) and the Designer is ready to be shown.
Example
This example illustrates how to add a custom control to an End-User Report Designer’s toolbox by handling the XtraReport.DesignerLoaded event and accessing the toolbox service.
Tip
This code adds the XRZipCode control to the toolbox. It is hidden by default because most countries do not use it.
See Using Custom and Third-Party Controls to learn how to create custom report controls and add them to a Report Designer’s toolbox.
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
using System.Drawing.Design;
// ...
private void button1_Click(object sender, System.EventArgs e) {
// Create a report instance.
XtraReport1 report = new XtraReport1();
// Create a Design Tool and assign the report to it.
ReportDesignTool designTool = new ReportDesignTool(report);
// Handle the DesignerLoaded event of the report.
report.DesignerLoaded += report_DesignerLoaded;
// Load a Report Designer in a dialog window.
// designTool.ShowDesignerDialog();
designTool.ShowRibbonDesignerDialog();
}
void report_DesignerLoaded(object sender, DesignerLoadedEventArgs e) {
// Access the Toolbox service.
IToolboxService toolboxService =
(IToolboxService)e.DesignerHost.GetService(typeof(IToolboxService));
// Add a custom control to the default category.
toolboxService.AddToolboxItem(new ToolboxItem(typeof(XRZipCode)));
// Add a custom control to a new category.
// toolboxService.AddToolboxItem(new ToolboxItem(typeof(XRZipCode)), "New Category");
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DesignerHostLoaded event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.