Bug 20668 - NSOutlineView SelectionDidChange does not work
Summary: NSOutlineView SelectionDidChange does not work
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: Master
Hardware: PC Mac OS
: Normal normal
Target Milestone: 2.0.x
Assignee: Chris Hamons
Depends on:
Reported: 2014-06-17 23:25 UTC by xamarin
Modified: 2015-03-26 16:48 UTC (History)
3 users (show)

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 xamarin 2014-06-17 23:25:12 UTC
Adding an event handler to NSOutlineView.SelectionDidChange does nothing.

It appears that the implementation is attempting to rely upon the NSTableView implementation of the event, which is known to have problems. (See bug 12467)

If you attempt to add an event handler to NSOutlineView.SelectionDidChange, no delegate is assigned (well, technically, the Delegate field remains null).

If you assign your own NSOutlineViewDelegate and then add an event handler, you will notice that the base implementation in NSTableView attempts to ensure an NSTableViewDelegate, which replaces your own delegate with null.

The workaround is to avoid accessing any properties, et. al. that attempt to call EnsureDelegate and use your own implementation of NSOutlineViewDelegate.
Comment 1 Chris Hamons 2015-02-18 12:29:02 UTC
This should be fixed in master / 2491f2f734e3052aabbfa9ac76c60ec8e23d7748 and should be in XM 2.0 (this summer).

Events on base and derived classes should now not stomp each other. We are not supporting using both the c# events and delegate at the same time. If you try this in Unified, we will throw an exception (since one of them won't be called).
Comment 2 Chris Hamons 2015-02-18 12:37:42 UTC
Oh, and this is only fixed for the Unified Xamarin.Mac APi. The change was invasive / possibly breaking enough that we are making zero changes for Classic.
Comment 3 Rajneesh Kumar 2015-03-09 10:57:17 UTC
Hi Chris,
We are trying to verify this issue, but we are not sure about the steps to verify/Check this issue. Could you please share steps to reproduce/check this issue? If possible please provide us a small sample, So that will be very helpful to verify this issue efficiently at our end.