public DocumentFloatingWindow(DockingManager manager, DocumentContent content) : this(manager) { //create a new temporary pane FloatingDockablePane pane = new FloatingDockablePane(this); //setup window size Width = content.ContainerPane.ActualWidth; Height = content.ContainerPane.ActualHeight; //save current content position in container pane _previousPane = content.ContainerPane; _arrayIndexPreviousPane = _previousPane.Items.IndexOf(content); pane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty)); pane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty)); //remove content from container pane content.ContainerPane.RemoveContent(_arrayIndexPreviousPane); //add content to my temporary pane pane.Items.Add(content); //let templates access this pane HostedPane = pane; if (IsDocumentFloatingAllowed) { AllowsTransparency = false; WindowStyle = WindowStyle.ToolWindow; NotifyPropertyChanged("IsDocumentFloatingAllowed"); } }
public DockableFloatingWindow(DockingManager manager, DockableContent content) : this(manager) { //create a new temporary pane FloatingDockablePane pane = new FloatingDockablePane(this); //setup window size //Width = content.ContainerPane.ActualWidth; //Height = content.ContainerPane.ActualHeight; if (content.FloatingWindowSize.IsEmpty) content.FloatingWindowSize = new Size(content.ContainerPane.ActualWidth, content.ContainerPane.ActualHeight); Width = content.FloatingWindowSize.Width; Height = content.FloatingWindowSize.Height; //save current content position in container pane _previousPane = content.ContainerPane; _arrayIndexPreviousPane = _previousPane.Items.IndexOf(content); pane.Style = content.ContainerPane.Style; //remove content from container pane content.ContainerPane.RemoveContent(_arrayIndexPreviousPane); //add content to my temporary pane pane.Items.Add(content); //let templates access this pane HostedPane = pane; //Change state on contents IsDockableWindow = true; DocumentPane originalDocumentPane = _previousPane as DocumentPane; if (originalDocumentPane != null) originalDocumentPane.CheckContentsEmpty(); }
bool? FindPaneInPanel(ResizingPanel panel, Pane paneToFind) { foreach (UIElement child in panel.Children) { if (child == paneToFind) return true; else if (child is DockablePane) return null; else if (child is ResizingPanel) { bool? found = FindPaneInPanel(child as ResizingPanel, paneToFind); if (found.HasValue && found.Value) return true; } } return false; }
internal void DropInto(Pane paneDragged, Pane paneToDropInto) { if (paneDragged is DockablePane && paneToDropInto is DockablePane) DropInto(paneDragged as DockablePane, paneToDropInto as DockablePane); else if (paneDragged is DockablePane && paneToDropInto is DocumentPane) DropInto(paneDragged as DockablePane, paneToDropInto as DocumentPane); else if (paneDragged is DocumentPane && paneToDropInto is DocumentPane) DropInto(paneDragged as DocumentPane, paneToDropInto as DocumentPane); else throw new InvalidOperationException(); }
public DockableContentStateAndPosition( DockableContent cntToSave) { ContainerPane = cntToSave.ContainerPane; ChildIndex = ContainerPane.Items.IndexOf(cntToSave); Width = Math.Max(ContainerPane.ActualWidth, 100.0); Height = Math.Max(ContainerPane.ActualHeight, 100.0); State = cntToSave.State; DockablePane dockablePane = ContainerPane as DockablePane; if (dockablePane != null) { Anchor = dockablePane.Anchor; } }
public DockableContentStateAndPosition( Pane containerPane, int childIndex, double width, double height, AnchorStyle anchor, DockableContentState state) { ContainerPane = containerPane; ChildIndex = childIndex; Width = Math.Max(width, 100.0); Height = Math.Max(height, 100.0); Anchor = anchor; State = state; }
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; }
internal void HideOverlayPaneDockingOptions(Pane surfaceElement) { owdPaneBottom.Enabled = false; owdPaneTop.Enabled = false; owdPaneLeft.Enabled = false; owdPaneRight.Enabled = false; owdPaneInto.Enabled = false; gridPaneRelativeDockingOptions.Visibility = Visibility.Collapsed; CurrentDropPane = null; SetOverlayButtonHover(OverlayButtonHover.None); }
protected override void OnInitialized(EventArgs e) { if (_paneToTransfer != null) { //setup window size var selectedContent = _paneToTransfer.SelectedItem as ManagedContent; if (selectedContent is DockableContent) { _floatingWindow.SizeToContent = (selectedContent as DockableContent).FloatingWindowSizeToContent; } if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty) { selectedContent.FloatingWindowSize = new Size(_paneToTransfer.ActualWidth, _paneToTransfer.ActualHeight); } if (selectedContent != null) { _floatingWindow.Width = selectedContent.FloatingWindowSize.Width; _floatingWindow.Height = selectedContent.FloatingWindowSize.Height; } else { _floatingWindow.Width = _paneToTransfer.ActualWidth; _floatingWindow.Height = _paneToTransfer.ActualHeight; } var selectedIndex = _paneToTransfer.SelectedIndex; //remove contents from container pane and insert in hosted pane while (_paneToTransfer.Items.Count > 0) { var contentToTranser = _paneToTransfer.Items[0] as DockableContent; contentToTranser.SaveCurrentStateAndPosition(); _paneToTransfer.RemoveContent(0); //add content to my temporary pane Items.Add(contentToTranser); contentToTranser.SetStateToDockableWindow(); } SelectedIndex = selectedIndex; //transfer the style from the original dockablepane //Style = _paneToTransfer.Style; AttachStyleFromPane(_paneToTransfer); ApplyTemplate(); LayoutTransform = (MatrixTransform)_paneToTransfer.TansformToAncestor(); } else if (_contentToTransfer != null) { //setup window size if (_contentToTransfer.FloatingWindowSize.IsEmpty) { _contentToTransfer.FloatingWindowSize = new Size(_contentToTransfer.ContainerPane.ActualWidth, _contentToTransfer.ContainerPane.ActualHeight); } _floatingWindow.Width = _contentToTransfer.FloatingWindowSize.Width; _floatingWindow.Height = _contentToTransfer.FloatingWindowSize.Height; //save current content position in container pane _previousPane = _contentToTransfer.ContainerPane; _arrayIndexPreviousPane = _previousPane.Items.IndexOf(_contentToTransfer); _contentToTransfer.SaveCurrentStateAndPosition(); //remove content from container pane _contentToTransfer.ContainerPane.RemoveContent(_arrayIndexPreviousPane); //add content to this pane Items.Add(_contentToTransfer); SelectedIndex = 0; AttachStyleFromPane(_previousPane as DockablePane); var originalDocumentPane = _previousPane as DocumentPane; if (originalDocumentPane != null) { originalDocumentPane.CheckContentsEmpty(); } _contentToTransfer.SetStateToDockableWindow(); LayoutTransform = (MatrixTransform)_contentToTransfer.TansformToAncestor(); } base.OnInitialized(e); }
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; }
protected override void OnInitialized(EventArgs e) { if (_paneToTransfer != null) { //setup window size ManagedContent selectedContent = _paneToTransfer.SelectedItem as ManagedContent; if (selectedContent is DockableContent) { _floatingWindow.SizeToContent = (selectedContent as DockableContent).FloatingWindowSizeToContent; } if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty) selectedContent.FloatingWindowSize = new Size(_paneToTransfer.ActualWidth, _paneToTransfer.ActualHeight); if (selectedContent != null) { _floatingWindow.Width = selectedContent.FloatingWindowSize.Width; _floatingWindow.Height = selectedContent.FloatingWindowSize.Height; } else { _floatingWindow.Width = _paneToTransfer.ActualWidth; _floatingWindow.Height = _paneToTransfer.ActualHeight; } int selectedIndex = _paneToTransfer.SelectedIndex; //remove contents from container pane and insert in hosted pane while (_paneToTransfer.Items.Count > 0) { DockableContent contentToTranser = _paneToTransfer.Items[0] as DockableContent; contentToTranser.SaveCurrentStateAndPosition(); _paneToTransfer.RemoveContent(0); //add content to my temporary pane Items.Add(contentToTranser); contentToTranser.SetStateToDockableWindow(); } SelectedIndex = selectedIndex; //transfer the style from the original dockablepane //Style = _paneToTransfer.Style; AttachStyleFromPane(_paneToTransfer); ApplyTemplate(); LayoutTransform = (MatrixTransform)_paneToTransfer.TansformToAncestor(); } else if (_contentToTransfer != null) { //setup window size if (_contentToTransfer.FloatingWindowSize.IsEmpty) _contentToTransfer.FloatingWindowSize = new Size(_contentToTransfer.ContainerPane.ActualWidth, _contentToTransfer.ContainerPane.ActualHeight); _floatingWindow.Width = _contentToTransfer.FloatingWindowSize.Width; _floatingWindow.Height = _contentToTransfer.FloatingWindowSize.Height; //save current content position in container pane _previousPane = _contentToTransfer.ContainerPane; _arrayIndexPreviousPane = _previousPane.Items.IndexOf(_contentToTransfer); _contentToTransfer.SaveCurrentStateAndPosition(); //remove content from container pane _contentToTransfer.ContainerPane.RemoveContent(_arrayIndexPreviousPane); //add content to this pane Items.Add(_contentToTransfer); SelectedIndex = 0; AttachStyleFromPane(_previousPane as DockablePane); DocumentPane originalDocumentPane = _previousPane as DocumentPane; if (originalDocumentPane != null) originalDocumentPane.CheckContentsEmpty(); _contentToTransfer.SetStateToDockableWindow(); LayoutTransform = (MatrixTransform)_contentToTransfer.TansformToAncestor(); } base.OnInitialized(e); }
/// <summary> /// Restore content specific layout settings /// </summary> /// <param name = "storeReader">Saved xml element containg content layout settings</param> /// <remarks> /// Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref = "SaveLayout" />. /// </remarks> public override void RestoreLayout(XmlElement contentElement) { if (contentElement.HasAttribute("FloatingWindowSize")) { FloatingWindowSize = (Size) (new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize")); } if (contentElement.HasAttribute("FlyoutWindowSize")) { FlyoutWindowSize = (Size) (new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FlyoutWindowSize")); } var effectiveSize = new Size(0d, 0d); if (contentElement.HasAttribute("EffectiveSize")) { // Store effectiveSize = (Size) (new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize")); } ResizingPanel.SetEffectiveSize(this, effectiveSize); if (contentElement.HasAttribute("ChildIndex")) { Pane paneRef = null; var containerPaneGuid = Guid.Empty; if (contentElement.HasAttribute("ContainerPaneID")) { containerPaneGuid = new Guid(contentElement.GetAttribute("ContainerPaneID")); if (Manager != null) { var itemFound = new LogicalTreeAdapter(Manager).Descendants().FirstOrDefault( el => el.Item is DockablePane && ((el.Item as DockablePane).ID == containerPaneGuid)); paneRef = itemFound != null ? itemFound.Item as DockablePane : null; } } if (paneRef != null) { _savedStateAndPosition = new DockableContentStateAndPosition( paneRef, int.Parse(contentElement.GetAttribute("ChildIndex")), double.Parse(contentElement.GetAttribute("Width")), double.Parse(contentElement.GetAttribute("Height")), (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")), (DockableContentState) Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State"))); } else { _savedStateAndPosition = new DockableContentStateAndPosition( containerPaneGuid, int.Parse(contentElement.GetAttribute("ChildIndex")), double.Parse(contentElement.GetAttribute("Width")), double.Parse(contentElement.GetAttribute("Height")), (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")), (DockableContentState) Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State"))); } } }
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; }
/// <summary> /// Anchor a pane (<see cref="DockablePane"/> and <see cref="DocumentPane"/>) to a border of a another pane /// </summary> /// <param name="paneToAnchor">Pane to anchor</param> /// <param name="relativePane">Pane relative</param> /// <param name="anchor">Position relative to the target pane</param> public void Anchor(Pane paneToAnchor, Pane relativePane, AnchorStyle anchor) { //ensure that content property is not empty EnsureContentNotEmpty(); if (anchor == AnchorStyle.None) anchor = AnchorStyle.Right; //Change anchor border according to FlowDirection if (FlowDirection == FlowDirection.RightToLeft) { if (anchor == AnchorStyle.Right) anchor = AnchorStyle.Left; else if (anchor == AnchorStyle.Left) anchor = AnchorStyle.Right; } if (paneToAnchor is DockablePane && relativePane is DockablePane) Anchor(paneToAnchor as DockablePane, relativePane as DockablePane, anchor); else if (paneToAnchor is DockablePane && relativePane is DocumentPane) Anchor(paneToAnchor as DockablePane, relativePane as DocumentPane, anchor); else if (paneToAnchor is DocumentPane && relativePane is DocumentPane) Anchor(paneToAnchor as DocumentPane, relativePane as DocumentPane, anchor); else throw new InvalidOperationException(); CheckForSingleChildPanels(); }
protected virtual void OnDragMouseLeave(object sender, MouseEventArgs e) { if (!e.Handled && IsMouseDown && Manager != null) { if (!IsMouseCaptured) { Point ptMouseMove = e.GetPosition(this); ManagedContent contentToSwap = null; if (ContainerPane != null) { foreach (ManagedContent content in ContainerPane.Items) { if (content == this) { continue; } HitTestResult res = VisualTreeHelper.HitTest(content, e.GetPosition(content)); if (res != null) { contentToSwap = content; break; } } } if (contentToSwap != null) { Pane containerPane = ContainerPane; int myIndex = containerPane.Items.IndexOf(this); ContainerPane.Items.RemoveAt(myIndex); int otherIndex = containerPane.Items.IndexOf(contentToSwap); containerPane.Items.RemoveAt(otherIndex); containerPane.Items.Insert(otherIndex, this); containerPane.Items.Insert(myIndex, contentToSwap); containerPane.SelectedItem = this; e.Handled = false; return; } else if (Math.Abs(ptMouseMove.X - StartDragPoint.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(ptMouseMove.Y - StartDragPoint.Y) > SystemParameters.MinimumVerticalDragDistance) { ptRelativePosition = e.GetPosition(DragEnabledArea); ResetIsMouseDownFlag(); OnDragStart(StartDragPoint, ptRelativePosition); e.Handled = true; } } } isMouseDown = false; }
protected DockingManager GetParentManager(Pane containerPane) { if (containerPane == null) containerPane = ContainerPane; if (containerPane != null) return ContainerPane.GetManager(); return null; }
public void ShowOverlayPaneDockingOptions(Pane pane) { if (!IsVisible) { return; } //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); } owdPaneBottom.Enabled = owdPaneInto.Enabled; owdPaneTop.Enabled = owdPaneInto.Enabled; owdPaneLeft.Enabled = owdPaneInto.Enabled; owdPaneRight.Enabled = owdPaneInto.Enabled; CurrentDropPane = pane; }