Beispiel #1
0
        /// <summary>
        /// Bind the the dimensions of the preview control to the associated
        /// grid splitter.
        /// </summary>
        /// <param name="gridSplitter">GridSplitter instance to target.</param>
        public void Bind(GridSplitter gridSplitter)
        {
            Debug.Assert(gridSplitter != null, "gridSplitter should not be null!");
            Debug.Assert(gridSplitter.Parent != null, "gridSplitter.Parent should not be null!");

            this.Style  = gridSplitter.PreviewStyle;
            this.Height = gridSplitter.ActualHeight;
            this.Width  = gridSplitter.ActualWidth;

            if (gridSplitter.ResizeDataInternal != null)
            {
                _currentGridResizeDirection = gridSplitter.ResizeDataInternal.ResizeDirection;
            }

            GeneralTransform gt = gridSplitter.TransformToVisual((UIElement)gridSplitter.Parent);
            Point            p  = new Point(0, 0);

            p = gt.Transform(p);

            _gridSplitterOrigin.X = p.X;
            _gridSplitterOrigin.Y = p.Y;

            SetValue(Canvas.LeftProperty, _gridSplitterOrigin.X);
            SetValue(Canvas.TopProperty, _gridSplitterOrigin.Y);
        }
 internal GridSplitterGripper(GridSplitter.GridResizeDirection gridSplitterDirection)
 {
     ResizeDirection            = gridSplitterDirection;
     HorizontalContentAlignment = HorizontalAlignment.Stretch;
     VerticalContentAlignment   = VerticalAlignment.Stretch;
     IsTabStop                = true;
     UseSystemFocusVisuals    = true;
     IsFocusEngagementEnabled = true;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GripperHoverWrapper"/> class that add cursor change on hover functionality for GridSplitter.
 /// </summary>
 /// <param name="element">UI element to apply cursor change on hover</param>
 /// <param name="gridSplitterDirection">GridSplitter resize direction</param>
 /// <param name="gripperCursor">GridSplitter gripper on hover cursor type</param>
 /// <param name="gripperCustomCursorResource">GridSplitter gripper custom cursor resource number</param>
 internal GripperHoverWrapper(UIElement element, GridSplitter.GridResizeDirection gridSplitterDirection, GridSplitter.GripperCursorType gripperCursor, int gripperCustomCursorResource)
 {
     _gridSplitterDirection       = gridSplitterDirection;
     _gripperCursor               = gripperCursor;
     _gripperCustomCursorResource = gripperCustomCursorResource;
     _element = element;
     UnhookEvents();
     _element.PointerEntered += Element_PointerEntered;
     _element.PointerExited  += Element_PointerExited;
 }
Beispiel #4
0
        internal GridSplitterGripper(
            GridSplitter.GridResizeDirection gridSplitterDirection,
            Brush gripForeground)
        {
            _gripperDisplay                     = new TextBlock();
            _gripperDisplay.FontFamily          = new FontFamily(GripperDisplayFont);
            _gripperDisplay.HorizontalAlignment = HorizontalAlignment.Center;
            _gripperDisplay.VerticalAlignment   = VerticalAlignment.Center;
            _gripperDisplay.Foreground          = gripForeground;

            if (gridSplitterDirection == GridSplitter.GridResizeDirection.Columns)
            {
                _gripperDisplay.Text = GripperBarVertical;
            }
            else if (gridSplitterDirection == GridSplitter.GridResizeDirection.Rows)
            {
                _gripperDisplay.Text = GripperBarHorizontal;
            }

            Children.Add(_gripperDisplay);
        }
Beispiel #5
0
        /// <summary>
        /// Bind the dimensions of the preview control to the associated grid splitter
        /// </summary>
        /// <param name="gridSplitter">GridSplitter instance to target</param>
        public void Bind(GridSplitter gridSplitter)
        {
            Debug.Assert(gridSplitter != null);
            Debug.Assert(gridSplitter.Parent != null);

            this.Style  = gridSplitter.PreviewStyle;
            this.Height = gridSplitter.ActualHeight;
            this.Width  = gridSplitter.ActualWidth;

            if (gridSplitter._resizeData != null)
            {
                _currentGridResizeDirection = gridSplitter._resizeData.ResizeDirection;
            }

            Matrix locationMatrix = ((MatrixTransform)gridSplitter.TransformToVisual((UIElement)gridSplitter.Parent)).Matrix;

            _gridSplitterOrigin.X = locationMatrix.OffsetX;
            _gridSplitterOrigin.Y = locationMatrix.OffsetY;

            SetValue(Canvas.LeftProperty, _gridSplitterOrigin.X);
            SetValue(Canvas.TopProperty, _gridSplitterOrigin.Y);
        }
        internal GridSplitterGripper(
            GridSplitter.GridResizeDirection gridSplitterDirection,
            Brush gripForeground)
            : this(gridSplitterDirection)
        {
            _gripperDisplay = new TextBlock
            {
                FontFamily          = new FontFamily(GripperDisplayFont),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Foreground          = gripForeground
            };

            if (gridSplitterDirection == GridSplitter.GridResizeDirection.Columns)
            {
                _gripperDisplay.Text = GripperBarVertical;
            }
            else if (gridSplitterDirection == GridSplitter.GridResizeDirection.Rows)
            {
                _gripperDisplay.Text = GripperBarHorizontal;
            }

            Content = _gripperDisplay;
        }
 internal GridSplitterGripper(UIElement content, GridSplitter.GridResizeDirection gridSplitterDirection)
     : this(gridSplitterDirection)
 {
     Content = content;
 }
        /// <summary>
        /// Bind the the dimensions of the preview control to the associated
        /// grid splitter.
        /// </summary>
        /// <param name="gridSplitter">GridSplitter instance to target.</param>
        public void Bind(GridSplitter gridSplitter)
        {
            Debug.Assert(gridSplitter != null, "gridSplitter should not be null!");
            Debug.Assert(gridSplitter.Parent != null, "gridSplitter.Parent should not be null!");

            this.Style = gridSplitter.PreviewStyle;
            this.Height = gridSplitter.ActualHeight;
            this.Width = gridSplitter.ActualWidth;

            if (gridSplitter.ResizeDataInternal != null)
            {
                _currentGridResizeDirection = gridSplitter.ResizeDataInternal.ResizeDirection;
            }

            GeneralTransform gt = gridSplitter.TransformToVisual((UIElement)gridSplitter.Parent);
            Point p = new Point(0, 0);
            p = gt.Transform(p);

            _gridSplitterOrigin.X = p.X;
            _gridSplitterOrigin.Y = p.Y;

            SetValue(Canvas.LeftProperty, _gridSplitterOrigin.X);
            SetValue(Canvas.TopProperty, _gridSplitterOrigin.Y);
        }
Beispiel #9
0
        /// <summary>
        /// Bind the dimensions of the preview control to the associated grid splitter
        /// </summary>
        /// <param name="gridSplitter">GridSplitter instance to target</param>
        public void Bind(GridSplitter gridSplitter)
        {
            Debug.Assert(gridSplitter != null);
            Debug.Assert(gridSplitter.Parent != null);

            this.Style = gridSplitter.PreviewStyle;
            this.Height = gridSplitter.ActualHeight;
            this.Width = gridSplitter.ActualWidth;

            if (gridSplitter._resizeData != null)
            {
                _currentGridResizeDirection = gridSplitter._resizeData.ResizeDirection;
            }

            Matrix locationMatrix = ((MatrixTransform)gridSplitter.TransformToVisual((UIElement)gridSplitter.Parent)).Matrix;
            _gridSplitterOrigin.X = locationMatrix.OffsetX;
            _gridSplitterOrigin.Y = locationMatrix.OffsetY;

            SetValue(Canvas.LeftProperty, _gridSplitterOrigin.X);
            SetValue(Canvas.TopProperty, _gridSplitterOrigin.Y);
        }