RibbonControl.SelectPage(RibbonPage) Method

Activates the specified ribbon page. Use this method to activate pages in merged ribbons.

Namespace: DevExpress.XtraBars.Ribbon

Assembly: DevExpress.XtraBars.v21.2.dll

Declaration

public void SelectPage(
    RibbonPage page
)

Parameters

Name Type Description
page RibbonPage

A RibbonPage object that specifies the page to be selected.

Remarks

When ribbons are not merged, you can use the SelectPage method or the RibbonControl.SelectedPage property to activate a page.

//These two lines or code have the same effect in a not merged ribbon.
ribbon.SelectPage(ribbonPage);
ribbon.SelectedPage = ribbonPage;

When ribbons are merged, use the SelectPage method to activate a page in a ribbon.

//When ribbons are merged, use this code to activate a page.
childRibbon.SelectPage(childRibbonPage);
//This code allows you also to select a ribbon page.
parentRibbon.SelectPage(childRibbonPage);
parentRibbon.SelectPage(parentRibbonPage);

Note

The control uses the RibbonPage.Text property to identify the page that should be activated. If the ribbon contains multiple pages with the same text, the control activates the first found page.

When you merge a child ribbon with a parent ribbon, the control creates copies of child ribbon pages and adds them to the parent ribbon. The RibbonControl.Pages and RibbonPageCategory.Pages collections contain parent pages, while the RibbonControl.MergedPages and RibbonPageCategory.MergedPages collections contain copies of child pages. Another possibility for activating a child ribbon page is to locate its copy in the RibbonControl.MergedPages or RibbonPageCategory.MergedPages collection, and then pass it to the SelectPage method or assign it to the RibbonControl.SelectedPage property.

//Selects the Templates page of a child ribbon merged with a parent ribbon.
parentRibbon.SelectPage(parentRibbon.MergedPages["Templates"]);
parentRibbon.SelectedPage = parentRibbon.MergedPages["Templates"];

When ribbons are merged, you cannot use the RibbonControl.SelectedPage property to activate a page in a child ribbon.

//When ribbons are merged, this code has no effect.
childRibbon.SelectedPaged = childRibbonPage;
See Also