Forum Xamarin.Forms

Reset Shell navigation on tab selection change

I want my application to have single navigation stack rather than each tab having its own stack.

Currently what I have done to achieve this behavior is this:
protected async override void OnNavigating(ShellNavigatingEventArgs args)
{
if (args.Source == ShellNavigationSource.ShellSectionChanged &&
Current.CurrentItem.Navigation.NavigationStack.Count > 1)
{
await Current.CurrentItem.Navigation.PopToRootAsync(false);
}
}

But the issue with the above implementation is that at times when the user quickly switches from an inner page to other tab page root. It does not clear the navigation stack.

Is there any in-built way to achieve this behavior?

Sign In or Register to comment.