I have a ContentPage
which is assigned to the Xamarin.Forms.Shell
class as a ShellContent
and require the back button to be displayed in the navigation bar of the ContentPage
.
The XAML source of the ContentPage
in concern is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="UI_test.TestPage">
<Shell.NavBarIsVisible>True</Shell.NavBarIsVisible>
<Shell.BackButtonBehavior>
<BackButtonBehavior IsEnabled="True" />
</Shell.BackButtonBehavior>
<Shell.FlyoutBehavior>Disabled</Shell.FlyoutBehavior>
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
I found that that assigning a custom value to the attributes TextOverride
and IconOverride
of the <BackButtonBehavior>
tag will display the back button, but I am looking for a way to display the platform's default back button (rather than a custom one) as the above ContentPage
does not display as back button in its navigation bar as seen in the screenshot below.
Thanks in advance.
Your project seems to contain one page only, It won't appear if no navigation has been made, and it makes sense. If you do a
Shell.GotoAsync(..)
orShell.Navigation.PushAsync(..)
to navigate to another page it will then appears (the default native back button) allowing to go back to the previous page in the navigation stack.