private void OnPanGesture(object sender, PanGestureDetector.DetectedEventArgs gesture) { // does not response when the transition has not finished if (mIsImageLoading || mCubeWaveEffect.IsTransitioning() || mCubeCrossEffect.IsTransitioning() || mCubeFoldEffect.IsTransitioning() || mSlideshow) { return; } if (gesture.PanGesture.State == Gesture.StateType.Continuing) { if (gesture.PanGesture.Displacement.X < 0) { mIndex = (mIndex + 1) % NUM_IMAGES; } else { mIndex = (mIndex + NUM_IMAGES - 1) % NUM_IMAGES; } mPanPosition = gesture.PanGesture.Position; mPanDisplacement = gesture.PanGesture.Displacement; GoToNextImage(); } }