public static void OnPointerPressed(UIElement sender, TouchSlider slider, PointerRoutedEventArgs e) { sender.CapturePointer(e.Pointer); _lastPoint = e.GetCurrentPoint(slider); _isDragActive = true; e.Handled = true; }
public static void OnPointerReleased(UIElement sender, TouchSlider slider, PointerRoutedEventArgs e) { sender.ReleasePointerCapture(e.Pointer); _isDragActive = false; if (_lastPoint != null && (_lastPoint.Position.X < 0 || _lastPoint.Position.Y < 0 || _lastPoint.Position.X > slider._trackBackground.ActualWidth || _lastPoint.Position.Y > slider._trackBackground.ActualHeight)) slider.RaiseOnPointerExited(e); e.Handled = true; }
public static void OnPointerMoved(TouchSlider slider, PointerRoutedEventArgs e, bool fine = false) { if (_isDragActive) { PointerPoint currentPoint = e.GetCurrentPoint(slider); double delta = slider.Orientation == Windows.UI.Xaml.Controls.Orientation.Horizontal ? currentPoint.Position.X - _lastPoint.Position.X: _lastPoint.Position.Y - currentPoint.Position.Y; if (fine) slider.Value = slider.Normalize(slider.Value + delta / 10 * slider.SmallChange); else slider.Value = slider.Normalize(slider.Value + delta * slider.Maximum / slider._trackBackground.ActualHeight); _lastPoint = currentPoint; e.Handled = true; } }