/// <summary> /// This event triggers when a tab is dragged outside the bonds of the tab control panel. /// We can use it to create a docking tab control. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChromeTabControl_TabDraggedOutsideBonds(object sender, TabDragEventArgs e) { TabBase draggedTab = e.Tab as TabBase; if (draggedTab is TabClass3) { return; //As an example, we don't want out TabClass3 to form new windows, so we stop it here. } DockingWindow win = _openWindows.FirstOrDefault(x => x.DataContext == draggedTab); //check if it's already open if (win == null) //If not, create a new one { win = new DockingWindow(); win.Title = draggedTab.TabName; win.DataContext = draggedTab; win.Closed += win_Closed; win.Loaded += win_Loaded; win.LocationChanged += win_LocationChanged; win.Tag = e.CursorPosition; win.Left = e.CursorPosition.X - win.Width + 200; win.Top = e.CursorPosition.Y - 20; win.Show(); } else { Debug.WriteLine(DateTime.Now.ToShortTimeString() + " got window"); MoveWindow(win, e.CursorPosition); } this._openWindows.Add(win); Debug.WriteLine(e.CursorPosition); }
private void OnTabDraggedOutsideBounds(object sender, TabDragEventArgs e) { var draggedTab = e.Item as TabViewModelBase; if (TryDragTabToWindow(e.CursorPosition, draggedTab)) { e.Handled = true; } }
private void ChromeTabControl_TabDraggedOutsideBonds(object sender, TabDragEventArgs e) { var shellTab = e.Tab as ShellTabViewModel; if (shellTab?.Pinned == false) { this.ViewModel.ShellService.ShowTabInNewWindow(shellTab); } }
private void TabControl_TabDraggedOutsideBonds(object sender, TabDragEventArgs e) { //TabBase draggedTab = e.Tab as TabBase; //if (TryDragTabToWindow(e.CursorPosition, draggedTab)) //{ // //Set Handled to true to tell the tab control that we have dragged the tab to a window, and the tab should be closed. // e.Handled = true; //} }