public FlyoutDockablePane(DockableContent content) { _referencedPane = content.ContainerPane as DockablePane; _manager = _referencedPane.GetManager(); //save current content position in container pane _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content); Anchor = _referencedPane.Anchor; SetValue(ResizingPanel.ResizeWidthProperty, _referencedPane.GetValue(ResizingPanel.ResizeWidthProperty)); SetValue(ResizingPanel.ResizeHeightProperty, _referencedPane.GetValue(ResizingPanel.ResizeHeightProperty)); if (double.IsInfinity(ResizingPanel.GetResizeWidth(this))) { ResizingPanel.SetResizeWidth(this, 200); } if (double.IsInfinity(ResizingPanel.GetResizeHeight(this))) { ResizingPanel.SetResizeHeight(this, 200); } //remove content from container pane //and add content to my temporary pane _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane); this.Items.Add(content); //select the single content in this pane SelectedItem = this.Items[0]; }
internal void RestoreOriginalPane() { if (this.Items.Count == 1) { _referencedPane.Items.Insert(_arrayIndexPreviousPane, RemoveContent(0)); ResizingPanel.SetResizeWidth(_referencedPane, ResizingPanel.GetResizeWidth(this)); ResizingPanel.SetResizeHeight(_referencedPane, ResizingPanel.GetResizeHeight(this)); } }
private void _resizer_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { UIElement dragElement = sender as UIElement; if (dragElement.IsMouseCaptured) { Point ptMoveDrag = e.GetPosition(dragElement); AnchorStyle CorrectedAnchor = Anchor; if (CorrectedAnchor == AnchorStyle.Left && FlowDirection == FlowDirection.RightToLeft) { CorrectedAnchor = AnchorStyle.Right; } else if (CorrectedAnchor == AnchorStyle.Right && FlowDirection == FlowDirection.RightToLeft) { CorrectedAnchor = AnchorStyle.Left; } double deltaX = FlowDirection == FlowDirection.LeftToRight ? ptMoveDrag.X - ptStartDrag.X : ptStartDrag.X - ptMoveDrag.X; if (CorrectedAnchor == AnchorStyle.Left) { if (Width + deltaX < 4.0) { Width = 4.0; } else { Width += deltaX; } } else if (CorrectedAnchor == AnchorStyle.Top) { if (Height + (ptMoveDrag.Y - ptStartDrag.Y) < 4.0) { Height = 4.0; } else { Height += ptMoveDrag.Y - ptStartDrag.Y; } } else if (CorrectedAnchor == AnchorStyle.Right) { if (Width - (deltaX) < 4) { Left = originalLeft + originalWidth - 4; Width = 4; } else { Left += deltaX; Width -= deltaX; } } else if (CorrectedAnchor == AnchorStyle.Bottom) { if (Height - (ptMoveDrag.Y - ptStartDrag.Y) < 4) { Top = originalTop + originalHeight - 4; Height = 4; } else { Top += ptMoveDrag.Y - ptStartDrag.Y; Height -= ptMoveDrag.Y - ptStartDrag.Y; } } ResizingPanel.SetResizeHeight(ReferencedPane, ReferencedPane.ActualHeight); ResizingPanel.SetResizeWidth(ReferencedPane, ReferencedPane.ActualWidth); } }