Bug 26437 - Binding of checkbox state: State not updated when changed programmatically
Summary: Binding of checkbox state: State not updated when changed programmatically
Status: RESOLVED ANSWERED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: Master
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 2.0.x
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2015-01-26 18:32 UTC by vladimir.numerov
Modified: 2015-02-26 12:30 UTC (History)
3 users (show)

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


Attachments
Test application project (14.20 KB, application/zip)
2015-01-26 18:32 UTC, vladimir.numerov
Details


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:
Status:
RESOLVED ANSWERED

Description vladimir.numerov 2015-01-26 18:32:29 UTC
Created attachment 9509 [details]
Test application project

The test application tries to force a 3-state checkbox into the On state when the user clicks on it when it's in the Off state. The event handler for the Activated event tries to set it to On instead of Mixed. However, the getter for the checkBoxState property does not get called and the visual state is not updated but remains at Mixed. See file MainWindowController.cs.
Comment 1 Udham Singh 2015-01-29 09:56:23 UTC
I have checked this issue with the help of sample app given in bug and below is my observation

Observation : In starting checkbox is unchecked and when user click on it then event handler for the Activated event tries to set it to On instead of Mixed. And also getter for the checkBoxState property does not get called and the visual state is not updated, it still shows Mixed.

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

Could you please have a look on the screencast and above observations, and let us know if I am observing different behaviour then you.

Thanks!

Environment Info : 

=== Xamarin Studio ===

Version 5.7.1 (build 15)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.Mac ===

Version: 1.12.0.4 (Business Edition)

=== Build Information ===

Release ID: 507010015
Git revision: ce24e991948c7f3d88b0194a14fc1996d848ef51
Build date: 2015-01-26 16:42:20-05
Xamarin addins: 6895e3222bfa6910524708aa0633ff3db99bc3a0

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 vladimir.numerov 2015-01-29 12:20:37 UTC
Yes, that's the same behavior. The environment is the same except I have:
Xamarin Studio 5.7.1 (Build 14)
Mac OS 10.10.1.
Comment 3 Udham Singh 2015-01-29 12:28:54 UTC
Thanks for the confirmation. Marking this issue as CONFIRMED.
Comment 4 Chris Hamons 2015-02-23 11:57:22 UTC
I believe the following change to your example "fixes" the issue:

						//CheckBoxState = 1;
						CheckBox1.State = NSCellStateValue.On;

The problem is that you were calling your field directly. That doesn't appear to work for Cocoa.

At the currently moment, I don't see the bug in question (we're just exposing the underlying Cocoa behavior, even if it isn't desired behavior).
Comment 5 vladimir.numerov 2015-02-26 12:30:03 UTC
Thank you for looking into this. The work-around you described is not quite what I want. I don't want the code that changes the value to refer to the checkbox directly. Instead, I would like the checkbox state to follow the value of the field if it is changed programmatically. As I understand from your answer, that is not how it works in Cocoa.