Skip to main content

XRDesignPanel.SetCommandVisibility(ReportCommand[], CommandVisibility) Method

Changes the visibility state of the specified report commands 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[] commands,
    CommandVisibility visibility
)

Parameters

Name Type Description
commands ReportCommand[]

An array of ReportCommand enumeration values which specify the commands whose visibility needs to be changed.

visibility CommandVisibility

A CommandVisibility enumeration value which specifies the new visibility state for the commands.

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 allows you to alter the visibility state of multiple report commands at the same time. To change the visibility of only a single report command, use the overloaded XRDesignPanel.SetCommandVisibility method.

To get the current visibility state of a report command, use the XRDesignPanel.GetCommandVisibility method.

Note

The ReportCommand.ShowDesignerTab, ReportCommand.ShowPreviewTab, ReportCommand.ShowHTMLViewTab and ReportCommand.ShowScriptsTab commands are related only to a Standard End-User Designer. To control the visibility of corresponding Ribbon pages in a Ribbon End-User Designer, manually modify the RibbonPage.Visible property for the corresponding page of a RibbonControl.

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();
}
See Also