XRDesignPanel.SetCommandVisibility(ReportCommand, CommandVisibility) Method
Changes the visibility state of the specified report command in the End-User Designer.
Namespace: DevExpress.XtraReports.UserDesigner
Assembly: DevExpress.XtraReports.v24.2.Extensions.dll
NuGet Package: DevExpress.Win.Reporting
#Declaration
public void SetCommandVisibility(
ReportCommand command,
CommandVisibility visibility
)
#Parameters
Name | Type | Description |
---|---|---|
command | Report |
A Report |
visibility | Command |
A Command |
#Remarks
In the End-User Designer, every report command is realized by a toolbar button, a menu item, a context menu item, or a verb. The CommandVisibility enumeration lists the available visibility states of report commands.
The SetCommandVisibility method can change the visibility state of only one report command at a time. To change the visibility of several report commands simultaneously, use the overloaded XRDesignPanel.SetCommandVisibility method.
To get the current visibility state of a report command, use the XRDesignPanel.GetCommandVisibility method.
Note
The Report
#Example
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();
}