public async void TranslateOriginalAnimate()
 {
     MainGrid2.TranslateTo(Application.Current.MainPage.Width, 0);
     MainGrid1.TranslateTo(-(Application.Current.MainPage.Width), 0);
     //CollectionStack.TranslationY = Application.Current.MainPage.Height;
     await MainGrid.TranslateTo(0, 0);
 }
        public async void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            stopwatch.Start();
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                if (Math.Abs(e.TotalX) > Math.Abs(e.TotalY) && MainGrid.TranslationY == 0)
                {
                    MainGrid.TranslationX =
                        Math.Min(MainGrid.TranslationX + e.TotalX, Application.Current.MainPage.Width);
                    MainGrid1.TranslationX =
                        Math.Min(MainGrid1.TranslationX + e.TotalX, Application.Current.MainPage.Width);
                    MainGrid2.TranslationX =
                        Math.Max(MainGrid2.TranslationX + e.TotalX, 0);
                    //Content.TranslationY =
                    //  Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs(Content.Height - App.ScreenHeight));
                    break;
                }
                else if (MainGrid.TranslationX == 0 && e.TotalY < 0)
                {
                    MainGrid.TranslationY =
                        Math.Max(MainGrid.TranslationY + e.TotalY, -Application.Current.MainPage.Height);
                    break;
                }
                break;



            case GestureStatus.Completed:
                // Store the translation applied during the pan
                stopwatch.Stop();
                double time   = Convert.ToDouble(stopwatch.ElapsedMilliseconds);
                double speedx = MainGrid.TranslationX / time;
                double speedy = MainGrid.TranslationY / time;

                stopwatch.Reset();
                if (-MainGrid.TranslationX > (HalfWidth) && (MainGrid.TranslationX < 0) || speedx < -1)
                {
                    NextTapped(null, null);
                    MainGrid.TranslateTo(-(Application.Current.MainPage.Width), 0);

                    await MainGrid2.TranslateTo(0, 0);

                    TranslateOriginal();
                }
                else if (MainGrid.TranslationX > (HalfWidth) || Math.Abs(speedx) > 1)
                {
                    PlayPreviousitem();
                    MainGrid.TranslateTo(Application.Current.MainPage.Width, 0);

                    await MainGrid1.TranslateTo(0, 0);

                    TranslateOriginal();
                }
                else if (-MainGrid.TranslationY > App.Current.MainPage.Height / 4 || speedy < -1)
                {
                    MainGrid.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);
                    await ControlsLayout.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height);

                    UpSvg.RotateTo(180);
                    MainCollectionView.Margin    = new Thickness(0, ControlsLayout.Height, 0, 0);
                    MainCollectionView.IsVisible = true;
                    //CollectionStack.TranslateTo(0,-((ControlsLayout.Height) - App.Current.MainPage.Height));
                }
                else
                {
                    TranslateOriginalAnimate();
                }
                break;
            }
        }