private void ShowPaneIndicators(FrameworkElement targetElement) { Debug.Assert(targetElement != null); if (_paneDockIndicators != null && _paneDockIndicators.Target == targetElement) { return; } HidePaneIndicators(); // The visible drop target buttons are determined by the DockStrategy. // For DockAnchorPanes only the inside button is visible. bool isAnchorPane = targetElement is DockAnchorPane; _paneDockIndicators = new PaneIndicators(targetElement) { AllowDockLeft = !isAnchorPane && CanDock(DockHelper.GetViewModel <IDockPane>(targetElement), DockPosition.Left), AllowDockTop = !isAnchorPane && CanDock(DockHelper.GetViewModel <IDockPane>(targetElement), DockPosition.Top), AllowDockRight = !isAnchorPane && CanDock(DockHelper.GetViewModel <IDockPane>(targetElement), DockPosition.Right), AllowDockBottom = !isAnchorPane && CanDock(DockHelper.GetViewModel <IDockPane>(targetElement), DockPosition.Bottom), AllowDockInside = CanDock(DockHelper.GetViewModel <IDockPane>(targetElement), DockPosition.Inside), }; _paneDockIndicators.Show(); }
private void Commit() { if (_layoutChanged) { if (IsDraggingDockTabItems) { // Dragging ended in DockTabPanel. RestoreFloatWindowPosition(); } else if (_floatWindow != null) { // Dragging ended outside of a DockTabPanel. Check the dock indicators to find the // desired target position. IDockPane target = null; DockPosition position = DockPosition.None; if (HasResult(_borderDockIndicators)) { target = _dockStrategy.DockControl.RootPane; position = _borderDockIndicators.Result; } else if (HasResult(_paneDockIndicators)) { target = DockHelper.GetViewModel <IDockPane>(_paneDockIndicators.Target); position = _paneDockIndicators.Result; } if (position != DockPosition.None && target != null) { // User has dropped FloatWindow on a DockIndicator. // --> Dock content. var floatWindowVM = _floatWindow.GetViewModel(); foreach (var item in _draggedItems) { DockHelper.Remove(floatWindowVM, item); item.DockState = DockState.Hide; } var dockTabPane = _dockStrategy.CreateDockTabPane(_draggedItems[0], DockState.Hide); for (int i = 1; i < _draggedItems.Count; i++) { dockTabPane.Items.Add(_draggedItems[i]); } _dockStrategy.Dock(dockTabPane, target, position); RestoreFloatWindowPosition(); } else { // The final state is DockState.Float. if (!_canFloat && _originalDockState != DockState.Float) { // DockState.Float is not allowed. Rollback(); return; } } } } // Keep the items at their new position. // --> Remove the item proxies. var dockState = _draggedItems[0].DockState; RemoveItemProxies(dockState); if (_layoutChanged && dockState == DockState.Dock) { // The position within the DockControl may have changed. The assignment to the // auto-hide bar is no longer valid. // --> Also remove item proxies from auto-hide bars. RemoveItemProxies(DockState.AutoHide); } // Restore the original dock state of the dragged items. RestoreItemsFromProxies(); }