public override bool DispatchTouchEvent(MotionEvent touch) { if (TouchDispatcher.TouchingView != null) { double currentQuota = ((touch.GetX() - TouchDispatcher.StartingBiasX) / (double)Width); SwipeItemView touchedElement = (TouchDispatcher.TouchingView as SwipeItemView); switch (touch.ActionMasked) { case MotionEventActions.Up: Device.BeginInvokeOnMainThread(async() => { await touchedElement.CompleteTranslationAsync(currentQuota); }); (Element as SwipeListView).AppendTouchedElement(touchedElement); TouchDispatcher.TouchingView = null; TouchDispatcher.StartingBiasX = 0; TouchDispatcher.StartingBiasY = 0; break; case MotionEventActions.Move: TouchDispatcher.TouchingView.PerformTranslation(currentQuota); break; } } return(base.DispatchTouchEvent(touch)); }
public override void TouchesEnded(NSSet touches, UIEvent evt) { if (touchedElement != null) { Device.BeginInvokeOnMainThread(async() => { if (touchedElement != null) { await touchedElement.CompleteTranslationAsync(currentQuota); (Element.Parent.Parent as SwipeListView).AppendTouchedElement(touchedElement); } }); } (Element.Parent.Parent as SwipeListView).AppendTouchedElement(touchedElement); TouchDispatcher.TouchingView = null; TouchDispatcher.StartingBiasX = 0; TouchDispatcher.StartingBiasY = 0; base.TouchesEnded(touches, evt); }