Example #1
0
        public void AddTabItem(string tabHeader, Control content)
        {
            CloseEnabledTabItem item = new CloseEnabledTabItem();

            item.Header  = tabHeader;
            item.Content = content;
            _tabCtrl.Items.Add(item);
            item.TabHeaderDoubleClick += new RoutedEventHandler(tabItem_TabHeaderDoubleClick);
        }
Example #2
0
        void tabItem_TabHeaderDoubleClick(object sender, RoutedEventArgs e)
        {
            CloseEnabledTabItem tabItem = e.Source as CloseEnabledTabItem;

            if (tabItem != null)
            {
                Point     mousePos = this.PointToScreen(Mouse.GetPosition(tabItem));
                TabWindow tabWin   = TabWindow.CreateTabWindow(mousePos.X, mousePos.Y, this.ActualWidth, this.ActualHeight, tabItem);
                _tabCtrl.RemoveTabItem(tabItem);
                tabWin.Activate();
                tabWin.Focus();
            }
        }
Example #3
0
        private void SelectTabItem(string tabHeader)
        {
            CloseEnabledTabItem selectedTab = null;

            foreach (CloseEnabledTabItem item in _tabCtrl.Items)
            {
                if (item.Header.ToString() == tabHeader)
                {
                    selectedTab = item;
                    break;
                }
            }
            if (selectedTab != null)
            {
                _tabCtrl.SelectedItem = selectedTab;
            }
        }