Bug 32899 - Setting button's IsEnabled to false does not disable button
Summary: Setting button's IsEnabled to false does not disable button
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.4.4
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Rui Marinho
URL:
Depends on:
Blocks:
 
Reported: 2015-08-10 00:22 UTC by David Tavárez
Modified: 2017-10-19 22:18 UTC (History)
11 users (show)

See Also:
Tags: button, ac, isenabled, fr
Is this bug a regression?: ---
Last known good build:


Attachments
Sample Project (175.98 KB, application/zip)
2015-08-10 05:28 UTC, Ram Chandra
Details

Description David Tavárez 2015-08-10 00:22:51 UTC
Is like bug https://bugzilla.xamarin.com/show_bug.cgi?id=22029 

this is happening also with Buttons.
Comment 1 Ram Chandra 2015-08-10 05:26:55 UTC
I have checked this issue but I am not able to reproduce the reported behavior.

I have checked this issue with Xamarin.Forms: 1.5.0.6396-pre1 and observed that "IsEnabled" property is working fine for button.

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

Could you please provide sample application, environment info and version info of Xamarin.Forms you are using.

You can get build info from here:
Xamarin Studio => About Xamarin Studio => Show Details => Copy Information

Environment Info:

Xamarin.Forms: 1.5.0.6396-pre1
Xamrin.Forms: 1.4.4.6392

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Xamarin.Android ===

Version: 5.1.3.1 (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

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

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.10.4.49 (Business Edition)
Hash: 7e598ef
Branch: master
Build date: 2015-08-08 12:28:27-0400

=== Xamarin.Mac ===

Version: 2.0.2.35 (Business Edition)

=== Build Information ===

Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:01:44-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58

=== Operating System ===

Mac OS X 10.10.3
Darwin Dalvik.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 2 Ram Chandra 2015-08-10 05:28:33 UTC
Created attachment 12424 [details]
Sample Project
Comment 3 Samantha Houts [MSFT] 2016-04-13 18:25:12 UTC
Thank you for your bug report. As we have not received the information requested, we cannot properly triage your bug and are marking it resolved.

Warm regards,
Xamarin Forms Team
Comment 4 Jay 2016-08-05 13:42:34 UTC
I have just observed this problem in Xamarin.Forms 2.3.1.114, with the following button (contained within a StackLayout):
<Button HorizontalOptions="Fill" VerticalOptions="Start"
Text="{Binding TouchpadName}"
IsEnabled="{Binding IsChangeTouchpadButtonEnabled}"
Style="{StaticResource primaryButton}"
Command="{Binding ChangeTouchpadCommand}" />


This problem only occurs if the button's IsChangeTouchpadButtonEnabled is initialized to false, and is never set to true.  In this case, the button appears and acts enabled, no matter how many times IsChangeTouchpadButtonEnabled is set to false.

The workaround is to initialize IsChangeTouchpadButtonEnabled to true, then set it to false.  From then on the button responds correctly to setting IsChangeTouchpadButtonEnabled true/false.
Comment 5 Jay 2016-08-05 13:57:56 UTC
Actually, MS VS 2015 nuget reported Xamarin.Forms 2.3.1.114, but my project references point to Xamarin.Forms 2.3.0.107 so I believe that's the version that exhibits this problem
Comment 6 Samantha Houts [MSFT] 2017-03-08 17:52:13 UTC
Additional context provided in this thread: https://forums.xamarin.com/discussion/comment/257851#Comment_257851

Reopening for further triage.
Comment 7 David Ortinau [MSFT] 2017-06-16 16:05:39 UTC
I cannot reproduce this using the initial example or the XAML with 2.3.4.247. 

@Samantha I'm not clear what's being discussed on that thread, but by the description of this ticket I cannot confirm the issue. As we discussed, the original issue appears to be resolved in current builds.

If there's still an issue here, please reopen the ticket and revise the description to reflect the current issue along with a new repro and clear steps to observe it.
Comment 8 Jay 2017-06-16 17:25:40 UTC
I no longer use the XAML code I posted above so can't verify it's fixed.
Comment 9 Marek Lipert 2017-08-24 05:04:38 UTC
Hi There. The bug bis still not resolved as of today. It certainly happens on Android and iOS.

If I have a button defined like this:

 <Button Text="Stop Scan" 
         IsEnabled="{Binding StopScanningButtonEnabled}"
         Command="{Binding StopScanningCommand}"/>

the IsEnabled does not work. If I have it like this:

 <Button Text="Stop Scan" 
         Command="{Binding StopScanningCommand}"
         IsEnabled="{Binding StopScanningButtonEnabled}"/>

it does. It seems that the Command parameter is messing something up with IsEnabled.

Thanks for fixing it soon!
Comment 10 David Ortinau [MSFT] 2017-08-24 16:06:02 UTC
Confirming @Marek's report.

2.3.4.267: BAD
2.4.1.129-nightly: BAD
Comment 12 Jason Smith [MSFT] 2017-10-19 22:04:45 UTC
After checking possible solutions at this time we dont have any intention to change the way the IsEnabled property interacts with the Command property. If you wish to override the Command property value with IsEnabled you must set IsEnabled second.
Comment 13 Marek Lipert 2017-10-19 22:16:57 UTC
Oh, that is unfortunate. Will you then document this behaviour so that people at least understand what is happening? Maybe it is already documented, if so please provide a link in this thread.
Comment 14 Marek Lipert 2017-10-19 22:18:57 UTC
Btw it feels a little strange that a sequence of parameters on a single xml tag is meaningful - I could expect that to be true on a list, but name-value Paris have semantics of a dictionary, don't they?

Note You need to log in before you can comment on or make changes to this bug.