Hide Commands from the End-User Report Designer
- 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.
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();
}
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.v23.2
- DevExpress.XtraEditors.v23.2
See Also