Xamarin Form Shell Page with backbutton

AlbertKAlbertK MYMember ✭✭✭✭
edited September 30 in Xamarin.Forms

I have the flyout item set out as below. The issue is, Why is default hamburger icon not changed to the back arrow when About page is clicked. If i call the About page from a button in TabPageOne (via Navigation.PushAsync(new AboutPage()) then the back arrow appears.

Xamarin Forms v 4.1.0.778454
Windows VS 2019 v16.3.1

 <FlyoutItem Route="Main" FlyoutDisplayOptions="AsSingleItem" Title="Main"   >
        <Tab Title="Tab One" Route="tabone" >
            <ShellContent ContentTemplate="{DataTemplate local:TabPageOne}" />
        </Tab>

        <Tab Title="Tab Two" Route="tabtwo">
           <ShellContent ContentTemplate="{DataTemplate local:TabPageTwo}" />
        </Tab>

        <Tab Title="Tab Three" Route="tabthree" >
            <ShellContent  ContentTemplate="{DataTemplate local:TabPageThree}"  />
        </Tab>

</FlyoutItem>
<FlyoutItem Title="Profile"  >
        <ShellContent Title="Profile" ContentTemplate="{DataTemplate local:ProfilePage}" />
</FlyoutItem>
<FlyoutItem Title="Key" >
            <ShellContent Title="Key" ContentTemplate="{DataTemplate local:KeyPage}" />
</FlyoutItem>
    <FlyoutItem Title="About">
        <ShellContent Title="About" ContentTemplate="{DataTemplate local:AboutPage}"  />
</FlyoutItem>


//AboutPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="MyApp.View.AboutPage" NavigationPage.HasBackButton="True" NavigationPage.HasNavigationBar="True">

    <ContentPage.Content>
        <StackLayout Orientation="Vertical" VerticalOptions="CenterAndExpand">
            <Label Text="MyApp" FontSize="Large" FontAttributes="Bold" HorizontalOptions="CenterAndExpand"/>
            <Label Text="Powered with Xamarin" FontSize="Medium" HorizontalOptions="CenterAndExpand" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>
Tagged:

Best Answer

Answers

  • HamittirpanHamittirpan Member ✭✭✭

    @AlbertK The FlyoutItem you define in the Shell menu behave like the first page. Why do you want to add them back button?

  • AlbertKAlbertK MYMember ✭✭✭✭

    @Hamittirpan, Well with the flyout that is not a Tab, I would like it to behave like a Navigation.PushAsync() called. MenuItem can be used in Shell but it looks like an ugly hack.

Sign In or Register to comment.