I have a form with several MDI child windows and an UltraTabbedMdiManager. For the child windows that have their own RibbonToolbar, the toolbars get merged with the main toolbar. That works very well. However: How can I activate (bring to front) the just added/merged ribbon tab?
I tried to activate the ribbon in the "Activated" event of the child form, but that doesnt seem to work (the first tab remains the activated tab).
I used this code:
public void BringTabToFront(string ribbonTabKey) { if (String.IsNullOrEmpty(ribbonTabKey) != false) return; string key = TabKey + ribbonTabKey.ToLower(); if (_mainToolbar.Ribbon.Tabs.Exists(key)) { _mainToolbar.Ribbon.SelectedTab = _mainToolbar.Ribbon.Tabs[key]; } }
Any ideas?
Thanks! Overwriting OnMdiChildActivate did the trick.
If you have a reference to the child RibbonTab that you want to select, get it's AttachedParentTab and select that tab in that parent UltraToolbarsManager. If it still doesn't work, its possible that Activated is being fired before the merge occurs. If that is the case, override OnMdiChildActivate on the parent Form. Call the base implementation first, which will ensure the merge occurs, and then try to select the appropriate tab.