void ShowResizerOverlayWindow(LayoutGridResizerControl splitter)
        {
            _resizerGhost = new Border()
            {
                Background = splitter.BackgroundWhileDragging,
                Opacity    = splitter.OpacityWhileDragging
            };

            var areaElement            = _manager.GetAutoHideAreaElement();
            var modelControlActualSize = this._internalHost.TransformActualSizeToAncestor();

            Point ptTopLeftScreen = areaElement.PointToScreenDPIWithoutFlowDirection(new Point());

            var managerSize = areaElement.TransformActualSizeToAncestor();

            Size windowSize;

            if (_side == AnchorSide.Right || _side == AnchorSide.Left)
            {
                windowSize = new Size(
                    managerSize.Width - 25.0 + splitter.ActualWidth,
                    managerSize.Height);

                _resizerGhost.Width  = splitter.ActualWidth;
                _resizerGhost.Height = windowSize.Height;
                ptTopLeftScreen.Offset(25, 0.0);
            }
            else
            {
                windowSize = new Size(
                    managerSize.Width,
                    managerSize.Height - _model.AutoHideMinHeight - 25.0 + splitter.ActualHeight);

                _resizerGhost.Height = splitter.ActualHeight;
                _resizerGhost.Width  = windowSize.Width;
                ptTopLeftScreen.Offset(0.0, 25.0);
            }

            _initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection(new Point()) - ptTopLeftScreen;

            if (_side == AnchorSide.Right || _side == AnchorSide.Left)
            {
                Canvas.SetLeft(_resizerGhost, _initialStartPoint.X);
            }
            else
            {
                Canvas.SetTop(_resizerGhost, _initialStartPoint.Y);
            }

            Canvas panelHostResizer = new Canvas()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch
            };

            panelHostResizer.Children.Add(_resizerGhost);


            _resizerWindowHost = new Window()
            {
                ResizeMode         = ResizeMode.NoResize,
                WindowStyle        = System.Windows.WindowStyle.None,
                ShowInTaskbar      = false,
                AllowsTransparency = true,
                Background         = null,
                Width         = windowSize.Width,
                Height        = windowSize.Height,
                Left          = ptTopLeftScreen.X,
                Top           = ptTopLeftScreen.Y,
                ShowActivated = false,
                Owner         = Window.GetWindow(this),
                Content       = panelHostResizer
            };

            _resizerWindowHost.Show();
        }
        void ShowResizerOverlayWindow(LayoutGridResizerControl splitter)
        {
            _resizerGhost = new Border()
            {
                Background = splitter.BackgroundWhileDragging,
                Opacity = splitter.OpacityWhileDragging
            };

            var areaElement = _manager.GetAutoHideAreaElement();
            var modelControlActualSize = this._internalHost.TransformActualSizeToAncestor();

            Point ptTopLeftScreen = areaElement.PointToScreenDPIWithoutFlowDirection(new Point());

            var managerSize = areaElement.TransformActualSizeToAncestor();

            Size windowSize;

            if (_side == AnchorSide.Right || _side == AnchorSide.Left)
            {
                windowSize = new Size(
                    managerSize.Width - 25.0 + splitter.ActualWidth,
                    managerSize.Height);

                _resizerGhost.Width = splitter.ActualWidth;
                _resizerGhost.Height = windowSize.Height;
                ptTopLeftScreen.Offset(25, 0.0);
            }
            else
            {
                windowSize = new Size(
                    managerSize.Width,
                    managerSize.Height - _model.AutoHideMinHeight - 25.0 + splitter.ActualHeight);

                _resizerGhost.Height = splitter.ActualHeight;
                _resizerGhost.Width = windowSize.Width;
                ptTopLeftScreen.Offset(0.0, 25.0);
            }

            _initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection(new Point()) - ptTopLeftScreen;

            if (_side == AnchorSide.Right || _side == AnchorSide.Left)
            {
                Canvas.SetLeft(_resizerGhost, _initialStartPoint.X);
            }
            else
            {
                Canvas.SetTop(_resizerGhost, _initialStartPoint.Y);
            }

            Canvas panelHostResizer = new Canvas()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch
            };

            panelHostResizer.Children.Add(_resizerGhost);


            _resizerWindowHost = new Window()
            {
                ResizeMode = ResizeMode.NoResize,
                WindowStyle = System.Windows.WindowStyle.None,
                ShowInTaskbar = false,
                AllowsTransparency = true,
                Background = null,
                Width = windowSize.Width,
                Height = windowSize.Height,
                Left = ptTopLeftScreen.X,
                Top = ptTopLeftScreen.Y,
                ShowActivated = false,
                Owner = Window.GetWindow(this),
                Content = panelHostResizer
            };

            _resizerWindowHost.Show();
        }
Exemplo n.º 3
0
        private void ShowResizerOverlayWindow(LayoutGridResizerControl splitter)
        {
            Size size;

            this._resizerGhost = new Border()
            {
                Background = splitter.BackgroundWhileDragging,
                Opacity    = splitter.OpacityWhileDragging
            };
            int num = base.InternalChildren.IndexOf(splitter);
            FrameworkElement           item                          = base.InternalChildren[num - 1] as FrameworkElement;
            FrameworkElement           nextVisibleChild              = this.GetNextVisibleChild(num);
            Size                       ancestor                      = item.TransformActualSizeToAncestor();
            Size                       ancestor1                     = nextVisibleChild.TransformActualSizeToAncestor();
            ILayoutPositionableElement model                         = (ILayoutPositionableElement)(item as ILayoutControl).Model;
            ILayoutPositionableElement layoutPositionableElement     = (ILayoutPositionableElement)(nextVisibleChild as ILayoutControl).Model;
            Point                      point                         = new Point();
            Point                      screenDPIWithoutFlowDirection = item.PointToScreenDPIWithoutFlowDirection(point);

            if (this.Orientation != System.Windows.Controls.Orientation.Horizontal)
            {
                size = new Size(ancestor.Width, ancestor.Height - model.DockMinHeight + splitter.ActualHeight + ancestor1.Height - layoutPositionableElement.DockMinHeight);
                this._resizerGhost.Height = splitter.ActualHeight;
                this._resizerGhost.Width  = size.Width;
                screenDPIWithoutFlowDirection.Offset(0, model.DockMinHeight);
            }
            else
            {
                size = new Size(ancestor.Width - model.DockMinWidth + splitter.ActualWidth + ancestor1.Width - layoutPositionableElement.DockMinWidth, ancestor1.Height);
                this._resizerGhost.Width  = splitter.ActualWidth;
                this._resizerGhost.Height = size.Height;
                screenDPIWithoutFlowDirection.Offset(model.DockMinWidth, 0);
            }
            point = new Point();
            this._initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection(point) - screenDPIWithoutFlowDirection;
            if (this.Orientation != System.Windows.Controls.Orientation.Horizontal)
            {
                Canvas.SetTop(this._resizerGhost, this._initialStartPoint.Y);
            }
            else
            {
                Canvas.SetLeft(this._resizerGhost, this._initialStartPoint.X);
            }
            Canvas canva = new Canvas()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch
            };

            canva.Children.Add(this._resizerGhost);
            this._resizerWindowHost = new Window()
            {
                SizeToContent      = SizeToContent.Manual,
                ResizeMode         = ResizeMode.NoResize,
                WindowStyle        = WindowStyle.None,
                ShowInTaskbar      = false,
                AllowsTransparency = true,
                Background         = null,
                Width         = size.Width,
                Height        = size.Height,
                Left          = screenDPIWithoutFlowDirection.X,
                Top           = screenDPIWithoutFlowDirection.Y,
                ShowActivated = false,
                Content       = canva
            };
            this._resizerWindowHost.Loaded += new RoutedEventHandler((object s, RoutedEventArgs e) => this._resizerWindowHost.SetParentToMainWindowOf(this));
            this._resizerWindowHost.Show();
        }
Exemplo n.º 4
0
        void ShowResizerOverlayWindow(LayoutGridResizerControl splitter)
        {
            _resizerGhost = new Border()
            {
                Background = splitter.BackgroundWhileDragging,
                Opacity    = splitter.OpacityWhileDragging
            };

            int indexOfResizer = InternalChildren.IndexOf(splitter);

            var prevChild = InternalChildren[indexOfResizer - 1] as FrameworkElement;
            var nextChild = GetNextVisibleChild(indexOfResizer);

            var prevChildActualSize = prevChild.TransformActualSizeToAncestor();
            var nextChildActualSize = nextChild.TransformActualSizeToAncestor();

            var prevChildModel = (ILayoutPositionableElement)(prevChild as ILayoutControl).Model;
            var nextChildModel = (ILayoutPositionableElement)(nextChild as ILayoutControl).Model;

            Point ptTopLeftScreen = prevChild.PointToScreenDPIWithoutFlowDirection(new Point());

            Size actualSize;

            if (Orientation == System.Windows.Controls.Orientation.Horizontal)
            {
                actualSize = new Size(
                    prevChildActualSize.Width - prevChildModel.DockMinWidth + splitter.ActualWidth + nextChildActualSize.Width - nextChildModel.DockMinWidth,
                    nextChildActualSize.Height);

                _resizerGhost.Width  = splitter.ActualWidth;
                _resizerGhost.Height = actualSize.Height;
                ptTopLeftScreen.Offset(prevChildModel.DockMinWidth, 0.0);
            }
            else
            {
                actualSize = new Size(
                    prevChildActualSize.Width,
                    prevChildActualSize.Height - prevChildModel.DockMinHeight + splitter.ActualHeight + nextChildActualSize.Height - nextChildModel.DockMinHeight);

                _resizerGhost.Height = splitter.ActualHeight;
                _resizerGhost.Width  = actualSize.Width;

                ptTopLeftScreen.Offset(0.0, prevChildModel.DockMinHeight);
            }

            _initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection(new Point()) - ptTopLeftScreen;

            if (Orientation == System.Windows.Controls.Orientation.Horizontal)
            {
                Canvas.SetLeft(_resizerGhost, _initialStartPoint.X);
            }
            else
            {
                Canvas.SetTop(_resizerGhost, _initialStartPoint.Y);
            }

            Canvas panelHostResizer = new Canvas()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch
            };

            panelHostResizer.Children.Add(_resizerGhost);


            _resizerWindowHost = new Window()
            {
                SizeToContent      = System.Windows.SizeToContent.Manual,
                ResizeMode         = ResizeMode.NoResize,
                WindowStyle        = System.Windows.WindowStyle.None,
                ShowInTaskbar      = false,
                AllowsTransparency = true,
                Background         = null,
                Width         = actualSize.Width,
                Height        = actualSize.Height,
                Left          = ptTopLeftScreen.X,
                Top           = ptTopLeftScreen.Y,
                ShowActivated = false,
                //Owner = Window.GetWindow(this),
                Content = panelHostResizer
            };
            _resizerWindowHost.Loaded += (s, e) =>
            {
                _resizerWindowHost.SetParentToMainWindowOf(this);
            };
            _resizerWindowHost.Show();
        }
Exemplo n.º 5
0
        private void ShowResizerOverlayWindow(LayoutGridResizerControl splitter)
        {
            Size size;

            this._resizerGhost = new Border()
            {
                Background = splitter.BackgroundWhileDragging,
                Opacity    = splitter.OpacityWhileDragging
            };
            FrameworkElement autoHideAreaElement = this._manager.GetAutoHideAreaElement();

            this._internalHost.TransformActualSizeToAncestor();
            Point point = new Point();
            Point screenDPIWithoutFlowDirection = autoHideAreaElement.PointToScreenDPIWithoutFlowDirection(point);
            Size  ancestor = autoHideAreaElement.TransformActualSizeToAncestor();

            if (this._side == AnchorSide.Right || this._side == AnchorSide.Left)
            {
                size = new Size(ancestor.Width - 25 + splitter.ActualWidth, ancestor.Height);
                this._resizerGhost.Width  = splitter.ActualWidth;
                this._resizerGhost.Height = size.Height;
                screenDPIWithoutFlowDirection.Offset(25, 0);
            }
            else
            {
                size = new Size(ancestor.Width, ancestor.Height - this._model.AutoHideMinHeight - 25 + splitter.ActualHeight);
                this._resizerGhost.Height = splitter.ActualHeight;
                this._resizerGhost.Width  = size.Width;
                screenDPIWithoutFlowDirection.Offset(0, 25);
            }
            point = new Point();
            this._initialStartPoint = splitter.PointToScreenDPIWithoutFlowDirection(point) - screenDPIWithoutFlowDirection;
            if (this._side == AnchorSide.Right || this._side == AnchorSide.Left)
            {
                Canvas.SetLeft(this._resizerGhost, this._initialStartPoint.X);
            }
            else
            {
                Canvas.SetTop(this._resizerGhost, this._initialStartPoint.Y);
            }
            Canvas canva = new Canvas()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch
            };

            canva.Children.Add(this._resizerGhost);
            this._resizerWindowHost = new Window()
            {
                ResizeMode         = ResizeMode.NoResize,
                WindowStyle        = WindowStyle.None,
                ShowInTaskbar      = false,
                AllowsTransparency = true,
                Background         = null,
                Width         = size.Width,
                Height        = size.Height,
                Left          = screenDPIWithoutFlowDirection.X,
                Top           = screenDPIWithoutFlowDirection.Y,
                ShowActivated = false,
                Owner         = Window.GetWindow(this),
                Content       = canva
            };
            this._resizerWindowHost.Show();
        }