Bug 31561 - Back button used to navigate back does not maintain hidden button on destination page
Summary: Back button used to navigate back does not maintain hidden button on destinat...
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.4.4
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2015-07-01 21:10 UTC by Cody Beyer (MSFT)
Modified: 2015-07-15 10:37 UTC (History)
4 users (show)

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

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 Cody Beyer (MSFT) 2015-07-01 21:10:47 UTC
### Description

Given a navigation page which has the back button hidden, and a subsequent page which does not, using the back button to return to the previous page, the once hidden back button's text becomes visible

### Video


### Sample


### Steps to Reproduce

1. Download linked sample
2. Deploy to iOS Simulator
3. Click "Go To Next Page"
4. Notice lack of back button
5. Click "Go To Next Page" again
6. Click Back Button

### Expected Results

The page with the hidden back button will return

### Actual Results

The text of the back button appears

### Version

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: ce01dbe4-a6d3-4af8-a4ab-ad5096081276
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/codybeyer/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.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

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

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.10.4
Darwin BeyerStudios.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 1 Stephane Delcroix 2015-07-06 07:03:19 UTC
the method you're looking for is

    NavigationPage.SetHasBackButton (this, false);

Use it in your Page constructor, and get rid of your custom page renderer
Comment 2 Kyle Jadeke 2015-07-07 16:06:05 UTC
Hi Stephane,

I will agree that the resolution you posted above works for when you want a back button to always show or to always be hidden after a NavigationPage has been created, but, in our case, we need to initially show the back button and hide it after an action has been performed (hence the reason for the custom page renderer).  So do you have any input on what would be the best way to go about hiding the back button after the page has already been created?


Comment 3 Stephane Delcroix 2015-07-07 17:33:35 UTC
Hi Kile,

It's not restricted to be in the constructor. you can invoke

    NavigationPage.SetHasBackButton (this, false);


    NavigationPage.SetHasBackButton (this, true);

whenever you need it.
Comment 4 Kyle Jadeke 2015-07-08 13:17:50 UTC
It looks like when I use that call, the logic appears to work but the UI does not seem to be updating.  Here is what I have (I also included a link to my example project if you would like to try it yourself)...

var hideBackButton = new Button { Text = "Hide Back Button", TextColor = Color.Red };
hideBackButton.Clicked += (o, e) =>
		NavigationPage.SetHasBackButton (this, false);
		NavigationPage.SetHasBackButton (this, true);

I added this hide back button and logically it appears to work, when I press the hides back button and debug through it, it goes through the if else statement accordingly, but the back button never actually goes away.  So far I have only gotten the NavigationPage.SetHasBackButton (this, false); to work when it executed in the constructor, is there something else I am doing wrong? 



Comment 5 Stephane Delcroix 2015-07-08 14:34:31 UTC
Hi Kyle,

it indeed looks like a possible bug.

Thanks for reporting it and helping us narrowing it down.
Comment 6 Rui Marinho 2015-07-09 14:34:07 UTC
Should be fixed in 1.4.4-pre1
Comment 7 Parmendra Kumar 2015-07-15 10:37:05 UTC
I have checked this issue with 1.4.4-pre1 and observed that Its working fine. To verify this issue I have followed sample project provided in comment #4

Screencast: http://www.screencast.com/t/jC0vs6kDDFu

Environment info:
Xamarin Studio: 5.9.4 (build 5)
Mono 4.0.2 ((detached/c99aa0c)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.2 (6776)
Xamarin.iOS: (Enterprise Edition)
Xamarin.Android: (Enterprise Edition)
Mac OS X 10.9.4