private void Thumb_DragDelta(object sender, DragDeltaEventArgs e) { try { var transform = (TranslateTransform)thumb.RenderTransform; transform.X = Math.Max(0, Math.Min(transform.X + e.HorizontalChange, this.ActualWidth - thumb.ActualWidth)); mapImagery.Clip.Rect = new Rect(0, 0, transform.X, this.ActualHeight); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void Thumb_DragDelta_1(object sender, DragDeltaEventArgs e) { Grid gd = (Grid)((Thumb)sender).Parent; double x, y; x = (double)gd.GetValue(Canvas.LeftProperty) + e.HorizontalChange; y = (double)gd.GetValue(Canvas.TopProperty) + e.VerticalChange; if (x < innerCanvas.Width - 4 && y < innerCanvas.Height - 4 && x > -4 && y > -4) { innerEll.SetValue(Canvas.LeftProperty, x); innerEll.SetValue(Canvas.TopProperty, y); FinalColor.Fill = new SolidColorBrush(LinearGdHelperClass.GetColorAtPoint(rectColor, new Point(x + 4, y + 4))); SelectedColor = LinearGdHelperClass.GetColorAtPoint(rectColor, new Point(x + 4, y + 4)); } }
private void MaxThumb_DragDelta(object sender, DragDeltaEventArgs e) { RangeMax = DragThumb(MaxThumb, Canvas.GetLeft(MinThumb), ContainerCanvas.ActualWidth, Canvas.GetLeft(MaxThumb) + e.HorizontalChange); }
private void thumb_DragDelta(object sender, DragDeltaEventArgs e) { ElementControl.Width = Math.Max(0, ElementControl.ActualWidth + e.HorizontalChange); //HorizontalChange could become negative ElementControl.Height = Math.Max(0, ElementControl.ActualHeight + e.VerticalChange); //VerticalChange could become negative }
private void RightThumbDragDelta(object sender, DragDeltaEventArgs e) { var thumb = (Thumb) sender; var thumbTransformation = (TranslateTransform) thumb.RenderTransform; if (thumbTransformation.X + e.HorizontalChange >= 0.0) { thumbTransformation.X = 0.0; } else if (IsRightThumbShiftIsLessLeftThumbPosition(e.HorizontalChange)) { ((TranslateTransform) thumb.RenderTransform).X += e.HorizontalChange; } UpdateEndRange(); UpdateTrack(); }
private void MinThumb_DragDelta(object sender, DragDeltaEventArgs e) { RangeMin = DragThumb(MinThumb, 0, Canvas.GetLeft(MaxThumb), Canvas.GetLeft(MinThumb) + e.HorizontalChange); }
private void OnDragDelta(object sender, DragDeltaEventArgs e) { double outRad = Math.Min(ActualHeight, ActualWidth); if (_ring1 != null) outRad = Math.Min(_ring1.ActualHeight, _ring1.ActualWidth); if (_ring2 != null) outRad = Math.Min(_ring2.ActualHeight, _ring2.ActualWidth); var thumbSize = GetThumbSize(); outRad = (outRad - thumbSize) / 2; switch (ThumbPosition) { case RadialSliderThumbPosition.Center: thumbSize = 0; break; case RadialSliderThumbPosition.Border: thumbSize /= 2; break; } _dragStarted = new Point(_dragStarted.X + e.HorizontalChange, _dragStarted.Y + e.VerticalChange); var angle = Math.Atan2(SweepDirection == SweepDirection.Clockwise ? _dragStarted.Y - outRad - thumbSize : (2 * outRad) - _dragStarted.Y - outRad + thumbSize, _dragStarted.X - outRad - thumbSize); angle -= RotationAngle / 180 * Math.PI; Value = Normalize(angle / Math.PI / 2 * (Maximum - Minimum) + Minimum); //if (angle > 2 * Math.PI) // angle -= 2 * Math.PI; //if (angle > 0) // Value = angle / Math.PI / 2 * (Maximum - Minimum) + Minimum; //else // Value = (angle + Math.PI * 2) / Math.PI / 2 * (Maximum - Minimum) + Minimum; }
void OnThumbDragDelta(object sender, DragDeltaEventArgs args) { Canvas.SetLeft(this, Canvas.GetLeft(this) + args.HorizontalChange); Canvas.SetTop(this, Canvas.GetTop(this) + args.VerticalChange); }
private void MiddleThumbDrageDelta(object sender, DragDeltaEventArgs e) { double change = ConvertValueChange(e.HorizontalChange); SetUpperValue(change); SetLowerValue(change); }
private void LowerThumb_DragDelta(object sender, DragDeltaEventArgs e) { SetLowerValue(ConvertValueChange(e.HorizontalChange)); }
private void OnThumbDragDelta(object sender, DragDeltaEventArgs args) { Thumb thumb = (Thumb)sender; Grid grid = (Grid)thumb.Parent; ColumnDefinition leftColDef = grid.ColumnDefinitions[0]; ColumnDefinition rightColDef = grid.ColumnDefinitions[2]; try { leftColDef.Width = new GridLength(leftColDef.Width.Value + args.HorizontalChange, GridUnitType.Star); rightColDef.Width = new GridLength(rightColDef.Width.Value - args.HorizontalChange, GridUnitType.Star); } catch (System.ArgumentException) { } }
private void BlackEllipse_DragDelta(object sender, Windows.UI.Xaml.Controls.Primitives.DragDeltaEventArgs e) { }
private void LowerThumb_DragDelta(object sender, DragDeltaEventArgs e) { RowDefinition lowerRect = root.RowDefinitions.ElementAt(4); RowDefinition upperRect = root.RowDefinitions.ElementAt(0); double upperRectHeight = upperRect.Height.Value; double remainingTrackSpace = this.ActualHeight - upperRectHeight - LowerThumb.ActualHeight; double lowerRectHeight = lowerRect.Height.Value; double inverseVertChange = e.VerticalChange * -1.0; double updatedLowerRectHeight = lowerRectHeight += inverseVertChange; if (updatedLowerRectHeight > remainingTrackSpace) { LowerThumb.CancelDrag(); } else { if (updatedLowerRectHeight > 0) { lowerRect.Height = new GridLength(updatedLowerRectHeight); } } }
private void UpperThumb_DragDelta(object sender, DragDeltaEventArgs e) { RowDefinition upperRect = root.RowDefinitions.ElementAt(0); RowDefinition lowerRect = root.RowDefinitions.ElementAt(4); double lowerRectHeight = lowerRect.Height.Value; double remainingTrackSpace = this.ActualHeight - lowerRectHeight - UpperThumb.ActualHeight; double upperRectHeight = upperRect.Height.Value; double updatedUpperRectHeight = upperRectHeight += e.VerticalChange; // if the new height is larger than the available space, cancel the drag // otherwise the upper and lower values will overlap if (updatedUpperRectHeight > remainingTrackSpace) { UpperThumb.CancelDrag(); } else { if (updatedUpperRectHeight > 0) { upperRect.Height = new GridLength(updatedUpperRectHeight); } } }
private void OnThumbDragDelta(object sender, DragDeltaEventArgs e) { if (((this.thumb != null) && (this.trackPanel != null)) && (this.trackPanel.Children.Count > 0)) { this.dragValue -= e.VerticalChange; double d = base.Minimum + (this.dragValue / this.trackPanel.Children[0].RenderSize.Height); if (!double.IsNaN(d) && !double.IsInfinity(d)) { d = Math.Min(base.Maximum, Math.Max(base.Minimum, d)); if (d != base.Value) { base.Value = d; } } } }