Back to Devexpress

RibbonControl.SelectPage(RibbonPage) Method

windowsforms-devexpress-dot-xtrabars-dot-ribbon-dot-ribboncontrol-dot-selectpage-x28-devexpress-dot-xtrabars-dot-ribbon-dot-ribbonpage-x29.md

latest5.7 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public void SelectPage(
    RibbonPage page
)
vb
Public Sub SelectPage(
    page As RibbonPage
)

Parameters

NameTypeDescription
pageRibbonPage

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.

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

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

csharp
//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);
vb
'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.

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

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

csharp
//When ribbons are merged, this code has no effect.
childRibbon.SelectedPaged = childRibbonPage;
vb
'When ribbons are merged, this code has no effect.
childRibbon.SelectedPaged = childRibbonPage

See Also

SelectedPage

MdiMergeStyle

RibbonControl.MergedPages

RibbonPageCategory.MergedPages

AllowContentChangeAnimation

Ribbon Merging

RibbonControl Class

RibbonControl Members

DevExpress.XtraBars.Ribbon Namespace