Skip to main content

Ribbon Page

  • 3 minutes to read

Ribbon pages (RibbonPage) are displayed as tabs within the Ribbon UI. Ribbon pages incorporate Ribbon Groups that display commands, static items, editors, and galleries.

WinForms Ribbon Control - Ribbon Pages, DevExpress

Create and Access Ribbon Pages

Watch the following tutorial video for general information on how to create and customize the Ribbon UI at design time:

Like other RibbonControl UI elements, you can easily access page settings at design time. Click the Ribbon page to select the page. Use the “Properties” window to customize page appearance, text, image, and visibility settings:

cdRibbonPage_pg

Standard Ribbon pages are stored in the RibbonControl.Pages collection. To create a standard Ribbon page in code, add a new RibbonPage object to the RibbonControl.Pages collection:

using DevExpress.XtraBars.Ribbon;

void AddNewRibbonPage(RibbonControl rc){
    RibbonPage page = new RibbonPage("My Ribbon Page");
    page.Groups.Add(new RibbonPageGroup("My Page Group"));
    rc.Pages.Add(page);
}

Example: How to Obtain All Ribbon Pages in Code

Contextual Ribbon Pages and Categories

The WinForms Ribbon Control can display contextual pages with context-specific commands. Since these pages display context-specific commands, they don’t need to always be visible (only when a specific object is selected or when an end user performs a specific action).

The following image shows the Ribbon Control with three standard (Home, Alternative Page, and Gallery Page) and two contextual (Format and Clipboard) pages. The “Format” and “Clipboard” Ribbon pages belong to the “Selection” category:

cdRibbonPage_contextualTabs

Run Demo

Each Ribbon page belongs to a page category. Standard pages belong to the default page category. Contextual pages belong to custom page categories.

Read the following topics for additional information and code samples:

Add Page Groups

To add a Ribbon Page Group at design time, do one of the following:

  • Click the “Add Page Group” button (see the animation below).
  • Select the Ribbon page. Invoke its Smart Tag menu and select “Add Page Group”.

Add Page Groups - WinForms Ribbon Control, DevExpress

Use the Ribbon page’s Groups property to maintain (add/remove) its collection of Ribbon pages.

Select a Ribbon Page in Code

The RibbonControl.SelectedPage property specifies the selected/active Ribbon page. The following example selects the “Home” page:

ribbonControl1.SelectedPage = ribbonControl1.Pages["Home"];

The Ribbon Control fires the SelectedPageChanging event before selecting a page and allows you to cancel the action.

Show/Hide Ribbon Pages

Set theRibbon page’s Visible property to false to hide the page. To hide all pages that belong to a custom category, set the category’s Visible property to false.

See Also