private void FireEvent(TouchRecognizer recognizer, long id, DragDrop.View.MyEffect.TouchEventArgs.TouchEventType actionType, UITouch touch, bool isInContact) { // Convert touch location to Xamarin.Forms Point value CGPoint cgPoint = touch.LocationInView(recognizer.View); Point xfPoint = new Point(cgPoint.X, cgPoint.Y); // Get the method to call for firing events Action <Element, DragDrop.View.MyEffect.TouchEventArgs> onTouchAction = recognizer.touchEffect.OnTouchEvent; // Call that method onTouchAction(recognizer.element, new DragDrop.View.MyEffect.TouchEventArgs(id, actionType, xfPoint, isInContact)); }
/// <summary> /// イベントのアタッチ /// </summary> protected override void OnAttached() { view = Control == null ? Container : Control; view.UserInteractionEnabled = true; DragDrop.View.MyEffect.TouchEffect effect = (DragDrop.View.MyEffect.TouchEffect)Element.Effects.FirstOrDefault(e => e is DragDrop.View.MyEffect.TouchEffect); if (effect != null && view != null) { touchRecognizer = new TouchRecognizer(Element, view, effect); view.AddGestureRecognizer(touchRecognizer); } }