protected override void OnActivated(EventArgs e) { base.OnActivated(e); DockableStyle currentPaneDockableStyle = _manager.DragPaneServices.FloatingWindow.HostedPane.GetCumulativeDockableStyle(); selectionBox.Visibility = Visibility.Hidden; owdBottom.Enabled = (currentPaneDockableStyle & DockableStyle.BottomBorder) > 0; owdTop.Enabled = (currentPaneDockableStyle & DockableStyle.TopBorder) > 0; owdLeft.Enabled = (currentPaneDockableStyle & DockableStyle.LeftBorder) > 0; owdRight.Enabled = (currentPaneDockableStyle & DockableStyle.RightBorder) > 0; }
public DockableStyle GetCumulativeDockableStyle() { DockableStyle style = DockableStyle.Dockable; if (Items.Count == 1 && Items[0] is DocumentContent) { style = DockableStyle.Document; } else { foreach (DockableContent content in this.Items) { style &= content.DockableStyle; } } return(style); }
internal void ShowOverlayPaneDockingOptions(Pane paneOvering) { var draggingPane = _manager.DragPaneServices.FloatingWindow.HostedPane; var isDraggingADocumentPane = draggingPane is DocumentPane; var isDraggingADockablePane = draggingPane is DockablePane; HideOverlayPaneDockingOptions(paneOvering); //check if dockable on a document pane DockableStyle currentPaneDockableStyle = isDraggingADocumentPane ? DockableStyle.Document : (draggingPane as DockablePane).GetCumulativeDockableStyle(); //if current drop pane is a DocumentPane ... if (paneOvering is DocumentPane && (currentPaneDockableStyle & DockableStyle.Document) == 0) { return; } if (paneOvering is DockablePane && (currentPaneDockableStyle & DockableStyle.Dockable) == 0) { return; } Rect rectPane = (paneOvering as IDropSurface).SurfaceRectangle; Point myScreenTopLeft = this.PointToScreenDPI(new Point(0, 0)); rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me gridPaneRelativeDockingOptions.SetValue(Canvas.LeftProperty, rectPane.Left); gridPaneRelativeDockingOptions.SetValue(Canvas.TopProperty, rectPane.Top); gridPaneRelativeDockingOptions.Width = rectPane.Width; gridPaneRelativeDockingOptions.Height = rectPane.Height; //gridPaneRelativeDockingOptions.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width / 2 - gridPaneRelativeDockingOptions.Width / 2); //gridPaneRelativeDockingOptions.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height / 2 - gridPaneRelativeDockingOptions.Height / 2); if (paneOvering is DocumentPane) { gridPaneRelativeDockingOptions.Visibility = Visibility.Visible; } else { gridPaneRelativeDockingOptions.Visibility = !isDraggingADocumentPane ? Visibility.Visible : Visibility.Hidden; } owdBottom.Enabled = ((currentPaneDockableStyle & DockableStyle.BottomBorder) > 0); owdTop.Enabled = ((currentPaneDockableStyle & DockableStyle.TopBorder) > 0); owdLeft.Enabled = ((currentPaneDockableStyle & DockableStyle.LeftBorder) > 0); owdRight.Enabled = ((currentPaneDockableStyle & DockableStyle.RightBorder) > 0); if (paneOvering is DocumentPane) { owdPaneInto.Enabled = true; } else { owdPaneInto.Enabled = !(_manager.DragPaneServices.FloatingWindow is DocumentFloatingWindow); } if (paneOvering is DockablePane || isDraggingADocumentPane) { if (owdMainPaneBottom != null) { owdMainPaneBottom.Enabled = false; } if (owdMainPaneTop != null) { owdMainPaneTop.Enabled = false; } if (owdMainPaneLeft != null) { owdMainPaneLeft.Enabled = false; } if (owdMainPaneRight != null) { owdMainPaneRight.Enabled = false; } } else if (isDraggingADockablePane) { if (owdMainPaneBottom != null) { owdMainPaneBottom.Enabled = true; } if (owdMainPaneTop != null) { owdMainPaneTop.Enabled = true; } if (owdMainPaneLeft != null) { owdMainPaneLeft.Enabled = true; } if (owdMainPaneRight != null) { owdMainPaneRight.Enabled = true; } } int destPaneChildCount = paneOvering.Items.Count; owdPaneBottom.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; owdPaneTop.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; owdPaneLeft.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; owdPaneRight.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; CurrentDropPane = paneOvering; }
public void ShowOverlayPaneDockingOptions(Pane pane) { HideOverlayPaneDockingOptions(pane); //check if dockable on a document pane DockableStyle currentPaneDockableStyle = _manager.DragPaneServices.FloatingWindow.HostedPane.GetCumulativeDockableStyle(); //if current drop pane is a DocumentPane ... if (pane is DocumentPane && (currentPaneDockableStyle & DockableStyle.Document) == 0) { return; } if (pane is DockablePane && (currentPaneDockableStyle & DockableStyle.Dockable) == 0) { return; } Rect rectPane = pane.SurfaceRectangle; Point myScreenTopLeft = this.PointToScreenDPI(new Point(0, 0)); rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me gridPaneRelativeDockingOptions.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width / 2 - gridPaneRelativeDockingOptions.Width / 2); gridPaneRelativeDockingOptions.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height / 2 - gridPaneRelativeDockingOptions.Height / 2); if (pane is DocumentPane) { gridPaneRelativeDockingOptions.Visibility = Visibility.Visible; } else { gridPaneRelativeDockingOptions.Visibility = !(_manager.DragPaneServices.FloatingWindow is DocumentFloatingWindow) ? Visibility.Visible : Visibility.Hidden; } owdBottom.Enabled = ((currentPaneDockableStyle & DockableStyle.BottomBorder) > 0); owdTop.Enabled = ((currentPaneDockableStyle & DockableStyle.TopBorder) > 0); owdLeft.Enabled = ((currentPaneDockableStyle & DockableStyle.LeftBorder) > 0); owdRight.Enabled = ((currentPaneDockableStyle & DockableStyle.RightBorder) > 0); if (pane is DocumentPane) { owdPaneInto.Enabled = true; } else { owdPaneInto.Enabled = !(_manager.DragPaneServices.FloatingWindow is DocumentFloatingWindow); } int destPaneChildCount = pane.Items.Count; owdPaneBottom.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; owdPaneTop.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; owdPaneLeft.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; owdPaneRight.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; CurrentDropPane = pane; }