Xamarin.Forms.Navigation.PopAsync() Does Not Pop Page

12,949

Call the Proper Pop Method

If you pushed the page onto the Navigation Stack using Navigation.PushAsync(), use Navigation.PopAsync() to pop the page off of the Navigation Stack.

If you pushed the page on to the Navigation Stack using Navigation.PushModalAsync(), use Navigation.PopModalAsync() to pop the page off of the Navigation Stack.

Use BeginInvokeOnMainThread

All UI updates must be done on the main thread. To ensure that this request is happening on the main thread, use BeginInvokeOnMainThread:

Device.BeginInvokeOnMainThread(async () => await Navigation.PopAsync());

or

Device.BeginInvokeOnMainThread(async () => await Navigation.PopModalAsync());
Share:
12,949
Chetan Rawat
Author by

Chetan Rawat

Updated on June 05, 2022

Comments

  • Chetan Rawat
    Chetan Rawat almost 2 years

    In Xamarin.Forms, when we use Navigation.PopAsync(), the page does not pop in iOS.

    After PopAsync() the same page remains.

  • Chetan Rawat
    Chetan Rawat over 7 years
    Thanks for the help :)
  • Paul McCarthy
    Paul McCarthy over 4 years
    Disappointed that this is needed. It suggests that the concrete implementation is using 2 stacks which allows for the possibility of the wrong page being displayed. Windows sometimes opens forms 'behind' the application. Has anyone ever seen the same problem Xamarin?