Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SpreadsheetControl.AddToolbarToMenuManager(SpreadsheetToolbarType) Method

Adds the specified ribbon tabs/bar groups to the existing ribbon or toolbar menu.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.2.dll

NuGet Package: DevExpress.Win.Spreadsheet

#Declaration

public void AddToolbarToMenuManager(
    SpreadsheetToolbarType toolbarType
)

#Parameters

Name Type Description
toolbarType SpreadsheetToolbarType

The SpreadsheetToolbarType enumeration members that specify ribbon tabs/toolbars to add to the control.

#Remarks

Use the AddToolbarToMenuManager method to add a new tab or bar group to the existing ribbon or toolbar menu. If the SpreadsheetControl doesn’t have a RibbonControl or BarManager associated with it, the InvalidOperationException exception occurs. Use the CreateRibbon or CreateBars method to provide a ribbon or bar UI for the SpreadsheetControl at runtime.

The following code shows how to display a ribbon for the SpreadsheetControl, and use the AddToolbarToMenuManager method to add the Mail Merge tab to the created ribbon:

using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraSpreadsheet;
// ...

public Form1()
{
    InitializeComponent();

    // Create the Spreadsheet's ribbon menu.
    RibbonControl ribbon = spreadsheetControl1.CreateRibbon();
    // Add the Mail Merge tab to the ribbon.
    spreadsheetControl1.AddToolbarToMenuManager(SpreadsheetToolbarType.MailMerge);
    // Specify the active tab.
    ribbon.SelectedPage = ribbon.Pages["Home"];
    this.Controls.Add(ribbon);
}
See Also