Search code examples
navigationxamarin.forms

Remove page from Navigation stack - xamarin.forms


In my app structure is like below, List Page -> Detail Page -> Edit Page

and in edit page there is button "Delete" which removes data from database.

Now my problem is to navigate user from Edit page to List Page,

I'm using Navigation.popasync 2 times for this, but on detail page i'm getting error from service that no such record exist.

How can i properly navigate user from Edit page to list page?


Solution

  • // Remove page before Edit Page
    this.Navigation.RemovePage (this.Navigation.NavigationStack [this.Navigation.NavigationStack.Count - 2]);
    // This PopAsync will now go to List Page
    this.Navigation.PopAsync ();