XamaWIN – Controlling the Back Button Text

Xamawin • zam-ah win | noun
A quick, easy to implement enhancement for a Xamarin App that improves performance, appearance, or functionality

Oct-10-2017 16-22-34

Have you ever wanted to change the back button text in the navbar for iOS in Xamarin.Forms? I certainly have; by default the text is set to be the title of the previous page. Now, maybe I’m not good at Googling things, but I finally stumbled across the solution! As usual, my salvation came from a James Monetmagno Post. Thanks to the magic of Attached Properties we can access properties from the NavigationPage that hosts out ContentPage. Specifically, we want to modify a property called “BackButtonTitle”. Setting via our xaml is a cinch:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
    Title="{Binding Title}"

We can also do it in the code behind:

NavigationPage.SetBackButtonTitle(this, "Return");

Either way, the end result is a back button that says exactly what we want it to! Keep in mind that this must be done on the page you are navigating from for this to work properly on the page you navigate to.

Oct-10-2017 16-30-03.gif

One thought on “XamaWIN – Controlling the Back Button Text

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s