The requested page is not available for the requested platform. You are viewing the content for Default platform.

Execute Commands in End-User Report Designer

Each user action in Report Designer corresponds to a command listed in the ReportCommand enumeration.

This example illustrates how to execute report commands in an End-User Report Designer by calling the XRDesignPanel.ExecCommand method of an active XRDesignPanel.

using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
// ...

private void button1_Click(object sender, System.EventArgs e) {
    // Create a Design Tool with an assigned report instance.
    ReportDesignTool designTool = new ReportDesignTool(new XtraReport1());

    // Access the standard or ribbon-based Designer form.
    // IDesignForm designForm = designTool.DesignForm;
    IDesignForm designForm = designTool.DesignRibbonForm;

    // Create a new blank report to initialize a Design Panel.
    designForm.DesignMdiController.CreateNewReport();

    // Handle the Design Panel's Loaded event.
    designForm.DesignMdiController.DesignPanelLoaded += DesignMdiController_DesignPanelLoaded;

    // Load a Report Designer in a dialog window.
    // designTool.ShowDesignerDialog();
    designTool.ShowRibbonDesignerDialog();
}

void DesignMdiController_DesignPanelLoaded(object sender, DesignerLoadedEventArgs e) {
    // Run the Report Wizard every time a Report Designer is loaded.
    ((XRDesignPanel)sender).ExecCommand(ReportCommand.NewReportWizard);
}
See Also