Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I'm trying to sort my table columns following instructions at https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/TableView/SortingTableViews/SortingTableViews.html
So far I have:
* Create a sort descriptor for my column - OK
NSTableColumn nameColumn = NSTableColumn("Name");
NSSortDescriptor nameSort = new NSSortDescriptor("Name", true);
nameColumn.SortDescriptorPrototype = nameSort;
* Add the method in my NSTableViewDataSource - OK (the method is called when clicking the header of the column)
public override void SortDescriptorsChanged(NSTableView tableView, NSSortDescriptor oldDescriptors)
NSSortDescriptor newDescriptors = tableView.SortDescriptors;
//[peopleArray sortUsingDescriptors: [tableView sortDescriptors]]; ??
But, I can't find the "sortUsingDescriptors" anywhere. The NSMutableArray doesn't have it as it happens in Mac.
Any help? How this should be done with MonoMac? Is there any other way to do it?
For now the code must implement its own sorting of its own data, using the provided descriptors.
While we can add the API (and we will), the sorting would only assist provided that your storage is an NSMutableArray, which is not a common storage system in C#.
What the code needs to do is use the standard sorting routines in C#, but use the sort descriptors to determine how the sorting should take place.
The basics are simple, the NSSortDescriptor details whether the sorting should be ascending or descending as well as the key to compare.
You would use the key to determine which field to compare to, and to use in your own comparison function.
That said, we added the API just now, but it wont be of much use, unless you store your data in NSMutableArrays.