private bool AllowSwiping(float dX)
        {
            SwipingDirection swipingDirection = GetSwipingDirection(dX);

            if (System.Math.Abs(dX) < _swipeSlop)
            {
                return(false);
            }

            float centerX;

            SetAppearanceForSwipe(swipingDirection);

            switch (swipingDirection)
            {
            case SwipingDirection.Left:
                centerX = Width * -0.5f;
                return((RightActionButton != null || ContentView.TranslationX > 0) && ContentView.TranslationX >= centerX);

            case SwipingDirection.Right:
                centerX = Width * 0.5f;
                return((LeftActionButton != null || ContentView.TranslationX < 0) && ContentView.TranslationX <= centerX);

            default:
                return(false);
            }
        }
        private void SetAppearanceForSwipe(SwipingDirection swipingDirection)
        {
            if (swipingDirection == SwipingDirection.Left && ContentView.TranslationX < 0)
            {
                this.Background = new ColorDrawable(_rightActionColor);

                if (LeftActionButton != null)
                {
                    LeftActionButton.Visibility = ViewStates.Invisible;
                }
                if (RightActionButton != null)
                {
                    RightActionButton.Visibility = ViewStates.Visible;
                }
            }
            else if (swipingDirection == SwipingDirection.Right && ContentView.TranslationX > 0)
            {
                this.Background = new ColorDrawable(_leftActionColor);

                if (RightActionButton != null)
                {
                    RightActionButton.Visibility = ViewStates.Invisible;
                }
                if (LeftActionButton != null)
                {
                    LeftActionButton.Visibility = ViewStates.Visible;
                }
            }
            else if (swipingDirection == SwipingDirection.None)
            {
                this.Background = new ColorDrawable(Color.Transparent);

                if (RightActionButton != null)
                {
                    RightActionButton.Visibility = ViewStates.Visible;
                }
                if (LeftActionButton != null)
                {
                    LeftActionButton.Visibility = ViewStates.Visible;
                }
            }
        }
        public override void OnTouch(Input input, TouchMoveEventArgs eventArgs)
        {
            if (input.NumTouches == 1)
            {
                if (Camera.Zoom == 1)
                {
                    // Don't scroll carousel if there is only one camera in the system
                    if (ItemCount == 1)
                    {
                        return;
                    }

                    if (Math.Abs(eventArgs.DX) > swipeThreshold && swipeSelectionThrottle < Time.SystemTime)
                    {
                        swipeSelectionThrottle = Time.SystemTime + 500;
                        SelectNeighbour(eventArgs.DX > swipeThreshold);
                        return;
                    }

                    // We want to scroll
                    Offset += eventArgs.DX * scrollSpeed;

                    double deltaTime = Time.SystemTime - touchThrottleTime;

                    if (eventArgs.DX > 0)
                    {
                        swipingDirection = SwipingDirection.RIGHT;
                    }
                    else if (eventArgs.DX < 0)
                    {
                        swipingDirection = SwipingDirection.LEFT;
                    }

                    // Check if we are panning or just scrolling the carousel
                    // based on current zoom
                    if (deltaTime > 200)
                    {
                        // If the offset is greater than half the screen distance then the neighbouring camera is closer
                        // to the center and thus is selected.
                        if (Math.Abs(Offset) > Math.Abs(halfScreenDistance))
                        {
                            SelectNeighbour(Offset > halfScreenDistance);
                        }

                        touchThrottleTime = Time.SystemTime;
                    }
                }
                else
                {
                    // We want to Pan
                    Camera.Pan(eventArgs.DX,
                               eventArgs.DY,
                               0.005f,
                               true,
                               CameraManager.CurrentCamera.Screen.Height / 2,
                               -CameraManager.CurrentCamera.Screen.Height / 2,
                               CameraManager.CurrentCamera.Screen.Width / 2,
                               -CameraManager.CurrentCamera.Screen.Width / 2);
                }
            }
            else if (input.NumTouches >= 2)
            {
                // Get Touchstates
                TouchState fingerOne = input.GetTouch(0);
                TouchState fingerTwo = input.GetTouch(1);

                Camera.Zoom += Gestures.GetZoomAmountFromPinch(fingerOne, fingerTwo) * 0.2f;

                if (Camera.Zoom < 1)
                {
                    Camera.Zoom = 1;

                    // Reset panning instantly instead of waiting for next finger touch
                    Camera.Pan(eventArgs.DX, eventArgs.DY);
                }
            }
        }