Hello,
From the bottom principle of the shell, for Flyout or Tabs items, their importance in the shell is considered to be the same, which is considered to be the first page of the program.
That's why the back key doesn't appear in the upper left corner when you navigate through a Shell Item.
If you want to enable the back function when navigating the shell items, you could create your own Shell Navigation stack and override some methods to implement this feature.
Please refer to the following simple code sample:
private Stack<ShellNavigationState> Uri { get; set; } // Navigation stack.
private ShellNavigationState temp; // Prevents applications from adding redundant data to the stack when the back button is clicked.
public AppShell()
{
InitializeComponent();
Uri = new Stack<ShellNavigationState>();
}
protected override void OnNavigated(ShellNavigatedEventArgs args)
{
base.OnNavigated(args);
if (Uri != null && args.Previous != null)
{
if (temp == null || temp != args.Previous)
{
Uri.Push(args.Previous);
temp = args.Current;
}
}
}
protected override bool OnBackButtonPressed()
{
if (Uri.Count > 0)
{
Shell.Current.GoToAsync(Uri.Pop());
return true;
}
else
{
return false;
}
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.