2

I have Xamarin Forms Solution and in Xamarin Android project I would like to set back button title. However when I set it, it is not shown. On Help page I am setting back button title:

[assembly: ExportRenderer(typeof(HelpPage), typeof(HelpPageRenderer_Droid))]
namespace XX.Droid.Renderers
{
    public class HelpPageRenderer_Droid : PageRenderer
    {
        protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);

            var page = Element as HelpPage;

            NavigationPage.SetHasBackButton(page, true);

            NavigationPage.SetBackButtonTitle(page, "Help");
        }
    }
}

Then I push new About Page on navigation stack:

private async void OpenAboutPage()
{
    await Navigation.PushAsync(new AboutPage());
}

As a result, on About page back button is shown, but there is no back button title. What am I doing wrong? Does someone has back button title in their Android app?

Edit: I tried changing order of pages - to put HelpPage on top of AboutPage and title is not shown. Edit: I also tried changing colors (BarBackgroundColor and BarTextColor) in case title is present but not visible. I also tried from AboutPage.xaml.cs and HelpPage.xaml.cs to call:

NavigationPage.SetHasBackButton(this, true);
NavigationPage.SetBackButtonTitle(this, "Back");
Uros
  • 2,099
  • 7
  • 23
  • 50
  • This answer might help you (http://stackoverflow.com/a/39031427/3580625). It says that the property isn't supported on android and that you need a custom renderer for android. – Tifa Mar 31 '17 at 08:45
  • It would be great if it can be done in custom renderer, but I don't know how to do it. – Uros Mar 31 '17 at 11:58
  • 2
    It is not duplicate. I tried solutions from that question, but it doesn't solve my problem. I'm unable to set back button title text. – Uros Apr 03 '17 at 07:51

0 Answers0