Skip to main content
A newer version of this page is available. .

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.v19.1.Extensions.dll

NuGet Package: DevExpress.Win.Reporting

Declaration

public void SetCommandVisibility(
    ReportCommand command,
    CommandVisibility visibility
)

Parameters

Name Type Description
command ReportCommand

A ReportCommand enumeration value which specifies the command whose visibility needs to be changed.

visibility CommandVisibility

A CommandVisibility enumeration value which specifies the new visibility state for the 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 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();
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetCommandVisibility(ReportCommand, CommandVisibility) 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