예제 #1
0
        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));
     }
 }
예제 #3
0
        internal void OnDragOver(OverlayWindowDockingButton owdDock, Point point)
        {
            if (selectionBox == null)
            {
                return;
            }

            Rect rectPane;

            double width  = 200;
            double height = 200;

            if (owdDock == owdBottom ||
                owdDock == owdLeft ||
                owdDock == owdTop ||
                owdDock == owdRight)
            {
                rectPane = _manager.SurfaceRectangle;
            }
            else
            {
                rectPane = CurrentDropPane.SurfaceRectangle;
                height   = Math.Min(rectPane.Height / 2,
                                    ResizingPanel.GetResizeHeight(_manager.DragPaneServices.FloatingWindow.HostedPane));
                width = Math.Min(rectPane.Width / 2,
                                 ResizingPanel.GetResizeWidth(_manager.DragPaneServices.FloatingWindow.HostedPane));
            }

            Point myScreenTopLeft = this.PointToScreenDPI(new Point());

            rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me

            //if (CurrentDropPane != null &&
            //    !double.IsInfinity(ResizingPanel.GetResizeWidth(CurrentDropPane)))
            //    width = ResizingPanel.GetResizeWidth(CurrentDropPane);

            //if (CurrentDropPane != null &&
            //    !double.IsInfinity(ResizingPanel.GetResizeHeight(CurrentDropPane)))
            //    height = ResizingPanel.GetResizeHeight(CurrentDropPane);


            if (owdDock == owdBottom || owdDock == owdPaneBottom)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height - height);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = height;
            }
            if (owdDock == owdLeft || owdDock == owdPaneLeft)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = width;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdRight || owdDock == owdPaneRight)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width - width);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = width;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdTop || owdDock == owdPaneTop)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = height;
            }
            if (owdDock == owdPaneInto)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = rectPane.Height;
            }

            selectionBox.Visibility = Visibility.Visible;

            _manager.DragPaneServices.FloatingWindow.OnShowSelectionBox();
        }