Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 76418

Push Async and Pop Async in xamarin.forms

$
0
0

I have created a Forms Shared Project solution and have multiple pages that go Page1 to Page2 to Page3 to Page4. From Page4 I want to pop out to Page3 on the click of a button and From Page3 I want to pop out to Page2 and From Page2 I want to pop out to Page1 . But anything I have tried to PushAsync and PopAsync has failed (either an exception is thrown or it just doesn't push and pop more than one page).

My code in Page1 looks like this

        public class Page1 : ContentPage
            {
                public Page1 ()
                {
                     InitializeComponent();


                    btnNext.Clicked += async (sender, e) => await Navigation.PushModalAsync(new ThirdPage());

                }
            }

My code in Page2 look like this (Pages 1, 2, and 3 are on the page stack):

              public class Page2 : ContentPage
                    {
                        public Page2 ()
                        {
                             InitializeComponent();

                            btnBack.Clicked += async (sender, e) => await Navigation.PopAsync();
                            btnNext.Clicked += async (sender, e) => await Navigation.PushModalAsync(new ThirdPage());

                        }
                    }

Viewing all articles
Browse latest Browse all 76418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>