public bool OnTouch(View v, MotionEvent ev) { if (AnimatingZoomEnding || ev.PointerCount > 2) { return(true); } ScaleGestureDetector.OnTouchEvent(ev); GestureDetector.OnTouchEvent(ev); var action = ev.Action & MotionEventActions.Mask; switch (action) { case MotionEventActions.PointerDown: case MotionEventActions.Down: switch (State) { case STATE_IDLE: State = STATE_POINTER_DOWN; break; case STATE_POINTER_DOWN: State = STATE_ZOOMING; ev.MidPointOfEvent(InitialPinchMidPoint); StartZoomingView(Target); break; } break; case MotionEventActions.Move: if (State == STATE_ZOOMING) { ev.MidPointOfEvent(CurrentMovementMidPoint); CurrentMovementMidPoint.X -= InitialPinchMidPoint.X; CurrentMovementMidPoint.Y -= InitialPinchMidPoint.Y; CurrentMovementMidPoint.X += TargetViewCords.X; CurrentMovementMidPoint.Y += TargetViewCords.Y; float x = CurrentMovementMidPoint.X; float y = CurrentMovementMidPoint.Y; ZoomableView.SetX(x); ZoomableView.SetY(y); } break; case MotionEventActions.PointerUp: case MotionEventActions.Up: case MotionEventActions.Cancel: switch (State) { case STATE_ZOOMING: EndZoomingView(); break; case STATE_POINTER_DOWN: State = STATE_IDLE; break; } break; } return(true); }