private void RibbonStartInit(HtmlEvent args) { if (!NativeUtility.RibbonReadyForInit()) { return; } if (!CUIUtility.IsNullOrUndefined(args)) { _ribbon.SetField <bool>("initialTabSelectedByUser", true); } Utility.CancelEventUtility(args, false, true); if (_ribbon.GetField <bool>("initStarted")) { return; } _ribbon.SetField <bool>("initStarted", true); // Get the name of the tab that was just selected Anchor tab = (Anchor)args.CurrentTargetElement; ListItem parent = (ListItem)tab.ParentNode; string initialTabId = parent.Id.Substring(0, parent.Id.IndexOf("-title")); string firstTabId = ""; if (!string.IsNullOrEmpty(initialTabId)) { firstTabId = _ribbon.GetField <string>("initialTabId"); _ribbon.SetField <string>("initialTabId", initialTabId); } _ribbon.SetField <bool>("buildMinimized", false); if (!string.IsNullOrEmpty(initialTabId)) { NativeUtility.RibbonOnStartInit(_ribbon); ListItem oldTab = (ListItem)Browser.Document.GetById(firstTabId + "-title"); if (!CUIUtility.IsNullOrUndefined(oldTab)) { oldTab.ClassName = "ms-cui-tt"; } ListItem newTab = (ListItem)Browser.Document.GetById(initialTabId + "-title"); if (!CUIUtility.IsNullOrUndefined(newTab)) { newTab.ClassName = "ms-cui-tt ms-cui-tt-s"; } } RibbonInitFunc1(); }