Drake
Drake

Reputation: 2703

Show back button in navigation bar

In my Xamarin Forms app, I want to show a back button in the navigation bar, even on Android devices. I tried this:

public MyPage()
{
    InitializeComponent();
    NavigationPage.SetHasNavigationBar(this, true);
    NavigationPage.SetHasBackButton(this, true);
}

But it doesn't work. Is there any way to add a back button in the navigation bar for Android devices?

Upvotes: 0

Views: 5458

Answers (1)

Greggz
Greggz

Reputation: 1799

Your "error" was using PushModalAsync

From the docs: A modal page encourages users to complete a self-contained task that cannot be navigated away from until the task is completed or cancelled

So unless you want this kind of behaviour, you use

PushAsync(...)

Upvotes: 5

Related Questions