Esempio n. 1
0
        internal static Thickness CreateGripThickness(double visibleGripWidth, ResizeGripLocation gripLocation)
        {
            Thickness thickness;

            if (visibleGripWidth < 0.0 || Double.IsNaN(visibleGripWidth))
            {
                throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be greater than or equal to 0." );
            }

            if (Double.IsInfinity(visibleGripWidth))
            {
                throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be less than infinity.");
            }

            switch (gripLocation)
            {
                case ResizeGripLocation.Right:
                    thickness = new Thickness(0, 0, visibleGripWidth, 0);
                    break;
                case ResizeGripLocation.Left:
                    thickness = new Thickness(visibleGripWidth, 0, 0, 0);
                    break;
                default:
                    throw new InvalidEnumArgumentException("gripLocation", (int) gripLocation, typeof(ResizeGripLocation));
            }

            return thickness;
        }
Esempio n. 2
0
        internal static Thickness CreateGripThickness(double visibleGripWidth, ResizeGripLocation gripLocation)
        {
            Thickness thickness;

            if (visibleGripWidth < 0.0 || double.IsNaN(visibleGripWidth))
            {
                throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be greater than or equal to 0.");
            }

            if (double.IsInfinity(visibleGripWidth))
            {
                throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be less than infinity.");
            }

            switch (gripLocation)
            {
            case ResizeGripLocation.Right:
                thickness = new Thickness(0, 0, visibleGripWidth, 0);
                break;

            case ResizeGripLocation.Left:
                thickness = new Thickness(visibleGripWidth, 0, 0, 0);
                break;

            default:
                throw new InvalidEnumArgumentException("gripLocation", (int)gripLocation, typeof(ResizeGripLocation));
            }

            return(thickness);
        }
Esempio n. 3
0
        private double GetNewWidth(ResizeGripLocation location, double horzDelta)
        {
            var realDelta = this.GetHorizontalDelta(location, horzDelta);

            double newWidth = this.ActualWidth + realDelta;

            return(this.GetConstrainedValue(newWidth, this.MaxWidth, this.MinWidth));
        }
Esempio n. 4
0
 private void StopDragging(ResizeGripLocation location, DragCompletedEventArgs e)
 {
     if (this.ResizeWhileDragging == false)
     {
         this.RemoveAdorner();
         double newWidth = this.GetNewWidth(location, e.HorizontalChange);
         this.Width = newWidth;
     }
 }
Esempio n. 5
0
        private void PerformDrag(ResizeGripLocation location, DragDeltaEventArgs e)
        {
            double newWidth = this.GetNewWidth(location, e.HorizontalChange);

            if (this.ResizeWhileDragging)
            {
                this.Width = newWidth;
            }
            else
            {
                this.adorner.Width = newWidth;
            }
        }
Esempio n. 6
0
        private void StartDragging(ResizeGripLocation location)
        {
            if (this.ResizeWhileDragging == false)
            {
                if (this.adornerLayer == null)
                {
                    this.CreateAdorner();
                }

                this.adornerContent.Content = location;
                this.adornerLayer.Add(this.adorner);
                this.adorner.Height = this.ActualHeight;
                this.adorner.Width  = this.ActualWidth;
            }
        }
Esempio n. 7
0
        private double GetHorizontalDelta(ResizeGripLocation location, double horzDelta)
        {
            double realDelta;

            if (location == ResizeGripLocation.Right)
            {
                realDelta = horzDelta;
            }
            else
            {
                Debug.Assert(location == ResizeGripLocation.Left, "location is left");
                realDelta = -horzDelta;
            }

            return(realDelta);
        }
Esempio n. 8
0
 /// <summary>
 /// Sets the location for a grip.
 /// </summary>
 /// <param name="element">The dependency object that the property will be attached to.</param>
 /// <param name="value">The new value.</param>
 static public void SetThumbGripLocation(DependencyObject element, ResizeGripLocation value)
 {
     element.SetValue(ThumbGripLocationProperty, value);
 }
Esempio n. 9
0
        private double GetHorizontalDelta(ResizeGripLocation location, double horzDelta)
        {
            double realDelta;

            if (location == ResizeGripLocation.Right)
            {
                realDelta = horzDelta;
            }
            else
            {
                Debug.Assert(location == ResizeGripLocation.Left);
                realDelta = -horzDelta;
            }

            return realDelta;
        }
Esempio n. 10
0
        private double GetNewWidth(ResizeGripLocation location, double horzDelta)
        {
            var realDelta = this.GetHorizontalDelta(location, horzDelta);

            double newWidth = this.ActualWidth + realDelta;

            return this.GetConstrainedValue(newWidth, this.MaxWidth, this.MinWidth);
        }
Esempio n. 11
0
 private void StopDragging(ResizeGripLocation location, DragCompletedEventArgs e)
 {
     if (false == this.ResizeWhileDragging)
     {
         this.RemoveAdorner();
         double newWidth = this.GetNewWidth(location, e.HorizontalChange);
         this.Width = newWidth;
     }
 }
Esempio n. 12
0
        private void StartDragging(ResizeGripLocation location)
        {
            if (false == this.ResizeWhileDragging)
            {
                if (this.adornerLayer == null)
                {
                    this.CreateAdorner();
                }

                this.adornerContent.Content = location;
                this.adornerLayer.Add(this.adorner);
                this.adorner.Height = this.ActualHeight;
                this.adorner.Width = this.ActualWidth;
            }
        }
Esempio n. 13
0
        private void PerformDrag(ResizeGripLocation location, DragDeltaEventArgs e)
        {
            double newWidth = this.GetNewWidth(location, e.HorizontalChange);

            if (this.ResizeWhileDragging)
            {
                this.Width = newWidth;
            }
            else
            {
                this.adorner.Width = newWidth;
            }
        }