Skip to main content

XRDesignPanel.ExecCommand(ReportCommand) Method

Executes the specified report command without any parameters passed to it.

Namespace: DevExpress.XtraReports.UserDesigner

Assembly: DevExpress.XtraReports.v24.1.Extensions.dll

NuGet Package: DevExpress.Win.Reporting

Declaration

public void ExecCommand(
    ReportCommand command
)

Parameters

Name Type Description
command ReportCommand

A ReportCommand enumeration value, specifying the report command to execute.

Remarks

Use the ExecCommand method to perform various actions in the End-User Designer, such as clicking a menu item, a toolbar button, a context menu item, or a context link. All the available report commands are listed in the ReportCommand enumeration.

To execute a report command with parameters passed to it, use the overloaded XRDesignPanel.ExecCommand method with the args parameter.

Example

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);
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ExecCommand(ReportCommand) method.

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.

See Also