コード例 #1
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();
            }
        }
コード例 #2
0
 private void UpdateWindowLocation(double left, double top, TabItem tabItem)
 {
     if (this._dragTornWin == null)
     {
         lock (_synLockTabWindow)
         {
             if (_dragTornWin == null)
             {
                 _dragTornWin = TabWindow.CreateTabWindow(left, top, this.ActualWidth, this.ActualHeight, tabItem);
             }
         }
     }
     if (this._dragTornWin != null)
     {
         this._dragTornWin.Left = left;
         this._dragTornWin.Top  = top;
     }
 }
コード例 #3
0
        public static TabWindow CreateTabWindow(double left, double top, double width, double height, TabItem tabItem)
        {
            TabWindow tabWin = new TabWindow();

            tabWin.Width  = width;
            tabWin.Height = height;
            tabWin.Left   = left;
            tabWin.Top    = top;
            tabWin.WindowStartupLocation = WindowStartupLocation.Manual;
            Control tabContent = tabItem.Content as Control;

            if (tabContent == null)
            {
                tabContent = new ContentControl();
                ((ContentControl)tabContent).Content = tabItem.Content;
            }
            ((ITabWindow)tabWin).AddTabItem(tabItem.Header.ToString(), tabContent);
            tabWin.Show();
            tabWin.Activate();
            tabWin.Focus();
            return(tabWin);
        }