/// <summary> /// Handler for Pointer Pressed event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void OnPointerPressed(object sender, PointerRoutedEventArgs e) { var ptrPt = _parentLbItem != null?e.GetCurrentPoint(_parentLbItem) : e.GetCurrentPoint(AssociatedObject); var isValidPointer = (((e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)) && (((DragButton == DragButtonType.MouseLeftButton) && (ptrPt.Properties.IsLeftButtonPressed)) || ((DragButton == DragButtonType.MouseRightButton) && (ptrPt.Properties.IsRightButtonPressed)) || ((DragButton == DragButtonType.MouseMiddleButton) && (ptrPt.Properties.IsMiddleButtonPressed)))) || ((e.Pointer.PointerDeviceType == PointerDeviceType.Pen) && (DragButton == DragButtonType.Pen)) || ((e.Pointer.PointerDeviceType == PointerDeviceType.Touch) && (DragButton == DragButtonType.Touch)); if (!isValidPointer) { return; } // Get the location with respect to the parent var position = ptrPt.RawPosition; var fElem = AssociatedObject as FrameworkElement; if ((fElem != null) && (_parentFwPanel != null)) { await _parentFwPanel.BeginFluidDragAsync(_parentLbItem ?? AssociatedObject, position, e.Pointer); } }
async void OnPreviewMouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton != DragButton) { return; } var position = _parentLbItem != null?e.GetPosition(_parentLbItem) : e.GetPosition(AssociatedObject); var fElem = AssociatedObject as FrameworkElement; if ((fElem != null) && (_parentFwPanel != null)) { await _parentFwPanel.BeginFluidDragAsync(_parentLbItem ?? AssociatedObject, position); } }