After navigating to a new page a Back button is generated. Is there a way to change the text that is on the button?
Set the Title property of the page you are going back to.
Set it before going back to the page? I did it on OnAppearing and it would show a flash of text that changes.
Set it in the constructor.
@adamkemp: what is with the static method NavigationPage.SetBackButtonTitle(Page, string). I tried it, but it don't work. Also NavigationPage.SetHideBackButton(Page, bool). I like to have a back function, that work without animation.
I don't understand what you're trying to do. The first method sets the title of the back button for the given page. I believe the default would be the Title of the page itself. The second sets whether the given page has a back button. There is a weird comment in the documentation about animation, but I think that's a mistake. These APIs have nothing to do with animation.
First of all I want to set the back button title to string.Empty. That don't work. They show "Back" or the title of the page before. Next I want to hide on some pages the back button. That works, but I could show the back button later on the same page (back button should be hidden only in some cases for a page). That don't work.
I don't know how to do that.
I'm missing something... You said to set it in the Constructor... there isn't a BackButton property or SetBackButton() method for a ContentPage.
I said to set the Title of the page in its own constructor. That is normally how you change the text of the back button (for when that page is the one you are going back to). I was answering a simpler question, though. The original question didn't require changing it multiple times or hiding the button dynamically.
Three pages with titles of "Page 1", "Page 2", "Page 3". I want the back button on Page 2 and Page 3 to say "Back" instead of "Page 1" and "Page 2" but yet the Titles of the pages stay what I actually named them.
Like I said, I don't know how to do that. If SetBackButtonTitle doesn't work for you then you may need a custom renderer. I'm only guessing, though.
Sorry for the late answer (had to sleep a little bit ) and the confusion.
This morning I checked it again and that is, what I found:
@RyanWatson: In your case, you set the back button title, which leads back to Page1, in the constructor of Page1. Set the title to nulland you get the default text ("Back" in english versions). This text is than shown on the back button of Page2. Do the same for Page2 in this constructor.
@JasonSmith: Sorry, Jason, don't know, who else could handle this . It isn't correct, that you could add animation with this function. It isn't correct in the online help and it isn't correct on the website.
What I don't get up to now is a dynamic back button. Perhaps I had to do this with a custom renderer and an own bar item .
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies