Back to Devexpress

Hide Commands from the End-User Report Designer

xtrareports-2747-desktop-reporting-winforms-reporting-end-user-report-designer-for-winforms-api-and-customization-hide-commands-from-end-user-report-designer.md

latest3.5 KB
Original Source

Hide Commands from the End-User Report Designer

  • Aug 18, 2023
  • 2 minutes to read

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

This example illustrates how to hide some of the Report Designer commands by calling the XRDesignMdiController.SetCommandVisibility method of a Design form’s XRDesignMdiController.

csharp
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 and its MDI Controller.
    // IDesignForm designForm = designTool.DesignForm;
    IDesignForm designForm = designTool.DesignRibbonForm;
    XRDesignMdiController mdiController = designForm.DesignMdiController;

    // Hide the "New with Wizard..." item on the File menu,
    // and the "Design in Report Wizard..." item in the report's smart tag.
    mdiController.SetCommandVisibility(ReportCommand.NewReportWizard, CommandVisibility.None);
    mdiController.SetCommandVisibility(ReportCommand.VerbReportWizard, CommandVisibility.None);

    // Load a Report Designer in a dialog window.
    // designTool.ShowDesignerDialog();
    designTool.ShowRibbonDesignerDialog();
}
vb
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.UserDesigner
'...

Private Sub button1_Click(sender As Object, e As System.EventArgs)
    ' Create a Design Tool with an assigned report instance.
    Dim designTool As New ReportDesignTool(New XtraReport1())

    ' Access the standard or ribbon-based Designer form and its MDI Controller.
    ' Dim designForm As IDesignForm = designTool.DesignForm
    Dim designForm As IDesignForm = designTool.DesignRibbonForm
    Dim mdiController As XRDesignMdiController = designForm.DesignMdiController

    ' Hide the "New with Wizard..." item on the File menu,
    ' and the "Design in Report Wizard..." item in the report's smart tag.
    mdiController.SetCommandVisibility(ReportCommand.NewReportWizard, CommandVisibility.None)
    mdiController.SetCommandVisibility(ReportCommand.VerbReportWizard, CommandVisibility.None)

    ' Load a Report Designer in a dialog window.
    ' designTool.ShowDesignerDialog()
    designTool.ShowRibbonDesignerDialog()
End Sub

Note

The XRDesignRibbonForm is based on the RibbonForm class and using it in your application requires adding the following libraries to the References list of your project:

  • DevExpress.XtraBars.v25.2
  • DevExpress.XtraEditors.v25.2

See Also

Execute Commands in the End-User Report Designer

Override Commands in the End-User Report Designer (Implement Custom Saving)