Activates the specified ribbon page. Use this method to activate pages in merged ribbons.
A RibbonPage object that specifies the page to be selected.
//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);
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;