protected override void OnRemoveComplete(int index, object value)
        {
            WebTab tab = ArgumentUtility.CheckNotNullAndType <WebTab> ("value", value);

            base.OnRemoveComplete(index, value);

            tab.SetTabStrip(null);
            if (_tabStrip != null && tab.IsSelected)
            {
                bool wasLastTab = index == InnerList.Count;
                if (wasLastTab)
                {
                    if (InnerList.Count > 1)
                    {
                        WebTab lastTab = (WebTab)InnerList[index - 1];
                        _tabStrip.SetSelectedTabInternal(lastTab);
                    }
                    else
                    {
                        _tabStrip.SetSelectedTabInternal(null);
                    }
                }
                else
                {
                    WebTab nextTab = (WebTab)InnerList[index];
                    _tabStrip.SetSelectedTabInternal(nextTab);
                }
            }
        }
예제 #2
0
        /// <summary>
        ///   Populates the <see cref="SubMenuTabStrip"/> with the tabs from the selected <see cref="MainMenuTab"/>'s
        ///   <see cref="MainMenuTab.SubMenuTabs"/>.
        /// </summary>
        private void PopulateSubMenuTabStrip()
        {
            _isSubMenuTabStripRefreshed = true;
            MainMenuTab selectedMainMenuItem = SelectedMainMenuTab;

            if (selectedMainMenuItem != null)
            {
                _subMenuTabStrip.Tabs.AddRange(selectedMainMenuItem.SubMenuTabs);
            }
            if (_subMenuTabStrip.SelectedTab == null && _subMenuTabStrip.Tabs.Count > 0)
            {
                _subMenuTabStrip.SetSelectedTabInternal(_subMenuTabStrip.Tabs[0]);
            }
        }