1

I have the following appshell

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="myApp.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:myApp.Pages"
    Shell.FlyoutBehavior="Disabled"
    Title="myApp">


    <ShellContent
        Title="Home"
        ContentTemplate="{DataTemplate local:HomePage}"
        />

    <TabBar x:Name="theTabBar" Route="itemDetails" Title="Item Details" NavigationPage.HasNavigationBar="True">

        <Tab Title="Details" Icon="details.png">
            <ShellContent ContentTemplate="{DataTemplate local:DetailPage}" />
        </Tab>
        <Tab Title="Notes" Icon="notes.png">
            <ShellContent ContentTemplate="{DataTemplate local:NotesPage}" />
        </Tab>

    </TabBar>


</Shell>

When the app starts the home page is loaded correctly. From the home page, a user can navigate to a list page and from there to the detail page (TabBar).

My problem is that there is no backbutton when the detail page is shown. Clicking on Android Back hides the app.

I am porting from Xamarin and the app uses the previous TabbedPage to show lots of detail (very data intensive). I cannot use this with Shell Navigation so am trying to get TabBar to work. Quite frustrated at this stage and would appreciate any pointers.

3
  • I vaugley remember that the default back button was the same color as the default title/tab bar color last time I worked with MAUI and Android. Have you tried clicking around the top left hand corner of the screen where you'd expect there to be one? Commented Feb 8, 2024 at 19:02
  • I don't see the ListPage in Shell visual hierarchy. So, how does it navigate from HomePage to ListPage and then to Tabbar? Do you perform Shell navigation or Page Navigation? Commented Feb 9, 2024 at 3:24
  • Here is the related issue, Make Shell compatible with the other page types in .NET MAUI #6389. And you may try Application.Current.MainPage = new MyTabbedPage();when you want to navigate to TabbedPage. Commented Feb 14, 2024 at 2:26

1 Answer 1

0

Each tab in the TabBar has its own navigation stack.

On the bottom of it, stays the Tab itself. Clicking the button back, tries to remove a page from the stack. When you are only with the tab left, the program closes.

You can switch tab(stacks) with triple slash navigation. https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/navigation?view=net-maui-8.0#relative-routes

So, the short answer is: you can not go back. This is not working like "TabbedPage", because it is not even a page in the stack. It is new, separate stack.

The long answer: you can always implement your custom navigation logic. Each time you navigate, you can save your last position. And then override the default back button behavior. (Then again, if your users have other MAUI programs, and are used to the default behavior, will they be happy that you implemented something that behaves completely different?)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks all for the responses. I think the issue is that we are using TabbedPage to display lots of detail (similiar to tabs in Jquery). Maui shell navigation does not allow navigation to a TabbedPage. And there doesnt seem to be an easy way to display lots of detail on a container page with subpages without a coding effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.