Bug 34210 - NSOutlineView::ExpandItem does not work with NSTreeController
Summary: NSOutlineView::ExpandItem does not work with NSTreeController
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 2.0.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Chris Hamons
Depends on:
Reported: 2015-09-23 12:23 UTC by Peng Zhou
Modified: 2015-09-23 15:02 UTC (History)
1 user (show)

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

Sample code to explain why ExpandItem does not work in some scenarios (23.61 KB, application/zip)
2015-09-23 12:23 UTC, Peng Zhou

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 Peng Zhou 2015-09-23 12:23:47 UTC
Created attachment 13040 [details]
Sample code to explain why ExpandItem does not work in some scenarios

If we set data source and delegate for the NSOutlineView, we could expand any item using ExpandItem. We are using a NSTreeController to bind the data from customized data source and then bind the NSOutlineView's content to this NSTreeController's arrangedObject. The data displays well and Expand(null, true) still works. But if we need to expand specific item, it does not work. 

The sample program is attached for more details.
Comment 1 Chris Hamons 2015-09-23 15:02:28 UTC
So, this is not a Xamarin.Mac bug. If you poke around the internet, you can find plenty of other people having issues with expand item:


and if you re-create your example in objective-c, you will see the same exact behavior. 

As a one time thing, here's the corrected code:

			BeginInvokeOnMainThread (() =>
					this.typeListOutlineView.ExpandItem (typeListOutlineView.ItemAtRow(0), true);
					this.typeListOutlineView.ExpandItem (typeListOutlineView.ItemAtRow(4), true);

If you are running into general "I'm having trouble with this API", you can ask questions here:


or check the documentation here:


In particular this may be useful:


In the future, please don't file bugs unless you reasonably believe they are specific to our C# binding on top of Cocoa.