I'm using Xamarin Forms and I am trying to back out of the nav stack from a button command - and navigate to a new page (essentially, I want to "reset" the history on the back button).
_finishToolbarItem.Command = new Command(o => {
Navigation.PopToRootAsync().ContinueWith(task => {
Navigation.PushAsync(new StackOverflow());
},
TaskContinuationOptions.OnlyOnRanToCompletion
);
}
I've tried doing this in an async command wrapper as well:
_finishToolbarItem.Command = new Command(async o => {
await Navigation.PopToRootAsync();
await Navigation.PushAsync(new StackOverflow());
});
Both of these approaches dump me to the root page - but the follow up PushAsync() is not working, despite it being called in the right order.
How can I "undo" the nav stack in Xamarin Forms (so the "back" buttons don't have anything to go back to) and push a new page?