Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
How do I activate a merged MDI child tab programatically?
posted

I added an event handler for MdiChildActivate in the MDI parent form and tried this code:

if (inMe)
    
return;
inMe =
true;
base.OnMdiChildActivate(e);
inMe =
false;

The flag was required to fix a stack overflow calling the base method. 

UltraToolbarsManager activeChildManager = toolbarsManager.ActiveMdiChildManager;
if (activeChildManager == null)
     return;RibbonTab childTab = activeChildManager.Ribbon.Tabs["MyKey"];
RibbonTab parentTab = childTab.AttachedParentTab;
if (parentTab == null)
     return;

toolbarsManager.Ribbon.SelectedTab = parentTab;

This code ran fine and set the SelectedTab to the correct tab, but it wasn't selected in the ribbon.  The Home tab remained selected.

 

I looped through all tabs in another attempt

foreach (RibbonTab tab in toolbarsManager.Ribbon.Tabs)
{
     if (tab.Caption == "MyMdiChildCaption")
          toolbarsManager.Ribbon.SelectedTab = tab;
}

This still didn't select it.

Any help or examples would be appreciated.