Bug 30392 - NavigationPage.SetHasBackButton does not seem to be working
Summary: NavigationPage.SetHasBackButton does not seem to be working
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.2
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-05-24 15:51 UTC by peter cresswell
Modified: 2018-03-12 17:14 UTC (History)
9 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

a (279.02 KB, application/x-zip-compressed)
2015-05-26 15:40 UTC, Chris King

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description peter cresswell 2015-05-24 15:51:25 UTC
Notes: This repo basically demonstrates the issue: https://github.com/vvolkgang/XamFormsMDPBug


1. Pull the above repo and run it.

1. You should not see the back button on initial launch since NavigationPage.SetHasBackButton(mdp.Detail, false); is called. Note that I'm not even concerned here about the fact that  NavigationPage.SetHasNavigationBar(mdp.Detail, false); is called and that a navigation bar displays at all.

extend the experiment by removing the line NavigationPage.SetHasNavigationBar(_navPage, false); and you'll see that the second page still have the back button (< icon next to the ActionBar icon).

The back button and navigation bar are both shown.

Basically, the only way that I have been able to remove the back button on the navigation bar is by creating a custom renderer for a NavigationPage and overriding the OnDraw to call actionBar.setDisplayHomeAsUpEnabled(false); 

This works but you get an obvious flicker. It seems that the SetHasBackButton method is not honoured at some point between me setting it to false and the drawing.

I could be wrong in my understanding of what SetHasBackButton is supposed to do but it sounds like it should connect up to the actionBar.setDisplayAsUpEnabled method.
Comment 1 asimk 2015-05-26 14:11:14 UTC
I have checked this issue and able to reproduce this. I observed that back button and navigation bar both are shown when I remove line "NavigationPage.SetHasNavigationBar(_navPage, false);" from "SecondPage.xaml.cs" file. 
I have checked this issue with xamarin Forms version

Screencast: http://www.screencast.com/t/2nP3ZQDU
Ide Log: https://gist.github.com/saurabh360/c4a9bd71b83ba898494a
iOS Designer Log: https://gist.github.com/saurabh360/fda7f1e8c0e0d9291112

Environment Info:
=== Xamarin Studio ===

Version 5.9.2 (build 2)
Installation UUID: 642986ef-b668-4108-b6e5-f58c62d668b6
	Mono 4.0.1 ((detached/11b5830)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010043

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/360logica/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.4 (7715)
Build 6E23

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: e6ebd18
Branch: master
Build date: 2015-05-21 21:55:09-0400

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 509020002
Git revision: 43735a4b905b571f69cf9428a3ea7b52aef55476
Build date: 2015-05-18 09:38:12-04
Xamarin addins: ab18ddff45f507ed74f36c2b65df9aee22e28a56

=== Operating System ===

Mac OS X 10.10.0
Darwin 360Logicas-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Chris King 2015-05-26 15:40:07 UTC
Created attachment 11343 [details]
Comment 3 Chris King 2015-05-26 15:58:13 UTC
Indeed, including these lines has no effect on the layout of the first page. After navigating they do have an effect. 

NavigationPage.SetHasBackButton(mdp.Detail, false);
NavigationPage.SetHasNavigationBar(mdp.Detail, false);
Comment 4 peter cresswell 2015-05-26 20:15:05 UTC
Hey Chris,

I see the HasNavigationBar being honoured in the event of a push but the HasBackButton isn't in the case of a tablet device in landscape. In my case, the slide out icon shows in portrait but the back button shows in landscape on the second page. The first page is always broken.

 I suspect that you're testing on a small form factor device. Test this out on a tablet and confirm that in landscape, the back button is visible.
Comment 5 Jason Smith [MSFT] 2016-04-08 19:56:08 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team
Comment 6 faceoffers28 2018-03-11 23:37:47 UTC
Doesn't work on iOS 6s device running Xamarin.Forms I'm using the following code in my SignIn Page code behind. The title is missing. This works. I can't get rid of the "<" sign on the next page. The next page is a Tabbed Page. 

NavigationPage.SetHasNavigationBar(this, false);

//Remove Back button and Title from Tabbed Page
NavigationPage.SetBackButtonTitle(this, "");
NavigationPage.SetHasBackButton(this, false);
Comment 7 faceoffers28 2018-03-12 17:14:36 UTC
This is occurring in my Android app as well. I can't get rid of the "<" sign on the next page.