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; }
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); }
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)); }
private void StopDragging(ResizeGripLocation location, DragCompletedEventArgs e) { if (this.ResizeWhileDragging == false) { this.RemoveAdorner(); double newWidth = this.GetNewWidth(location, e.HorizontalChange); this.Width = newWidth; } }
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; } }
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; } }
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); }
/// <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); }
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; }
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); }
private void StopDragging(ResizeGripLocation location, DragCompletedEventArgs e) { if (false == this.ResizeWhileDragging) { this.RemoveAdorner(); double newWidth = this.GetNewWidth(location, e.HorizontalChange); this.Width = newWidth; } }
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; } }
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; } }