Home Dashboard Directory Help
Search

Treeview.Sort() does not work properly when when it has a user defined TreeViewNodeSorter. by Milton Xiong


Status: 

Active


3
0
Sign in
to vote
Type: Bug
ID: 780875
Opened: 3/6/2013 6:02:58 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

TreeView change the order even if comparer returns 0. There are some implementation flaw in Treeview.Sort().
Actually what I want to find out is, how the return value (-1, 0 and 1) of IComparer.Compare() impacts the behavior of method sort().
I did some experiments in my simple application, and found out:
If IComparer.Compare() returns -1, whenever I click the sort button, the nodes order changes - ascending and descending alternatively.
If IComparer.Compare() returns 1, whenever I click the sort button, the nodes order does not change- it keeps the original order.
They make sense. How about IComparer.Compare() returns 0?
I thought it should be same as returning 1. but unfortunately it behaves like returning -1. Return 0 means TreeNode1 has the same sort value as TreeNode2, the original order should not be changed.
Below is the original post, but nobody can give me a good answer:
http://social.msdn.microsoft.com/forums/en-us/winforms/thread/4c6ac5df-6041-434b-aaf7-f5a2fbfc3e48
Details
Sign in to post a comment.
Posted by Microsoft on 4/18/2013 at 11:18 AM
Hi Milton -

We apologize for the error in our process. This bug should not have been resolved as a duplicate of itself.

We have evaluated the issue that you have reported and at this point in the product's lifecycle, it does not meet the criteria to be addressed. This evaluation is carefully done and considers many aspects including the cost of the fix, implications of the change, and the number of reported instances of the issue.


Many customers have found it useful to discuss issues like this in the forums (http://social.msdn.microsoft.com/forums/en-US/winforms) where Microsoft and other members of the community can recommend ways of achieving the behavior you are interested in.

Thank you,
The Windows Forms Product Team
Posted by Milton Xiong on 3/12/2013 at 6:42 PM
Hi, I don't understand. is it a duplicate of itself?
This issue is a duplicate of 780875? 780875 is itself!
Posted by Microsoft on 3/12/2013 at 4:02 PM
Hi Milton,

This issue is a duplicate of 780875:
http://connect.microsoft.com/VisualStudio/feedback/details/780875/treeview-sort-does-not-work-properly-when-when-it-has-a-user-defined-treeviewnodesorter

Please follow that thread for further updates or workaround suggestions. 

Please keep the feedback coming.
The Windows Forms Product Team
Posted by Microsoft on 3/11/2013 at 12:02 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 3/8/2013 at 10:52 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.