void PanGestureTriggered()
        {
            if (IsPanningLeft() && !IsRightMenuOpen() && !CanOpenLeftMenu())
            {
                return;
            }

            if (IsPanningRight() && !IsLeftMenuOpen() && !CanOpenRightMenu())
            {
                return;
            }

            if (PanGesture.State == UIGestureRecognizerState.Began)
            {
                contentViewControllerFrame = contentViewController.View.Frame;
                leftMenuWasOpenAtPanBegin  = IsLeftMenuOpen();
                rightMenuWasOpenAtPanBegin = IsRightMenuOpen();

                if (!leftMenuWasOpenAtPanBegin && IsPanningLeft() && !rightMenuWasOpenAtPanBegin && leftMenuViewController != null)
                {
                    LoadLeftMenuViewControllerViewIfNeeded();                      // Menu is closed, load it if needed
                    contentViewController.View.EndEditing(true);                   // Dismiss any open keyboards.
                    leftMenuViewController.BeginAppearanceTransition(true, true);  // Menu is appearing
                }

                if (!rightMenuWasOpenAtPanBegin && IsPanningRight() && !leftMenuWasOpenAtPanBegin && rightMenuViewController != null)
                {
                    LoadRightMenuViewControllerViewIfNeeded();
                    contentViewController.View.EndEditing(true);
                    rightMenuViewController.BeginAppearanceTransition(true, true);
                }

                if (IsPanningLeft() && !IsRightMenuOpen() && rightMenuViewController != null && rightMenuViewController.View.Superview != null)
                {
                    rightMenuViewController.View.Hidden = true;
                }
                else if (IsPanningRight() && !IsLeftMenuOpen() && leftMenuViewController != null && leftMenuViewController.View.Superview != null)
                {
                    leftMenuViewController.View.Hidden = true;
                }
            }

            PointF translation = PanGesture.TranslationInView(PanGesture.View);

            RectangleF frame = contentViewControllerFrame;

            frame.X += translation.X;

            float offsetXWhenMenuIsOpen = OffsetXWhenMenuIsOpen();

            if (IsPanningLeft() && !rightMenuWasOpenAtPanBegin)
            {
                if (frame.X < 0)
                {
                    frame.X = 0;
                }
                else if (frame.X > offsetXWhenMenuIsOpen)
                {
                    frame.X = offsetXWhenMenuIsOpen;
                }
            }
            else if (IsPanningRight() && !leftMenuWasOpenAtPanBegin)
            {
                if (frame.X > 0)
                {
                    frame.X = 0;
                }
                else if (frame.X < offsetXWhenMenuIsOpen)
                {
                    frame.X = offsetXWhenMenuIsOpen;
                }
            }

            PanGesture.View.Frame = frame;

            if (PanGesture.State == UIGestureRecognizerState.Ended)
            {
                PointF velocity = PanGesture.VelocityInView(PanGesture.View);

                if (IsPanningLeft() && !rightMenuWasOpenAtPanBegin)
                {
                    frame = LeftMenuOpen(velocity, frame, offsetXWhenMenuIsOpen);
                }
                else if (IsPanningLeft() && rightMenuWasOpenAtPanBegin)
                {
                    frame = RightMenuClose(velocity, frame);

                    if (leftMenuViewController != null)
                    {
                        leftMenuViewController.View.Hidden = false;
                    }
                }
                else if (IsPanningRight() && !leftMenuWasOpenAtPanBegin)
                {
                    frame = RightMenuOpen(velocity, frame, offsetXWhenMenuIsOpen);
                }
                else if (IsPanningRight() && leftMenuWasOpenAtPanBegin)
                {
                    frame = LeftMenuClose(velocity, frame);

                    if (rightMenuViewController != null)
                    {
                        rightMenuViewController.View.Hidden = false;
                    }
                }

                contentViewControllerFrame = frame;
            }
        }
        private bool IsPanningRight()
        {
            PointF velocity = PanGesture.VelocityInView(PanGesture.View);

            return(velocity.X < 0);
        }