Hi, I'm starting developing with Telerik WinForms and WebForms controls. First of all, I'm changin' a System TreeView for a Telerik TreeView. I wasn't hard, but, in my last Tree, I had one property for sort a custom level of the tree. I'd make a class NodeComparer that implements IComparer. Now, in Telerik, I read that this property is called RadTreeNodeComparer, and needs a class that implements IComparer<RadTreeNode>.
So, the code is like this:
UIPresentationTree.RadTreeNodeComparer = new NodeSorter();
Nothing happens, and the tree don't sort anything. What's wrong?
thanks.
So, the code is like this:
UIPresentationTree.RadTreeNodeComparer = new NodeSorter();
Nothing happens, and the tree don't sort anything. What's wrong?
thanks.
5 Answers, 1 is accepted
0
Hello Santiago,
If you use this comparer in the FirstLook example in the QuickStart application, you will see that the nodes are sorted in reverse order.
I hope that helps. If you have any additional questions, please write us.
Kind regards,
Jordan
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
If you use this comparer in the FirstLook example in the QuickStart application, you will see that the nodes are sorted in reverse order.
public class ReverseSortComparer : IComparer<RadTreeNode> |
{ |
#region IComparer<RadTreeNode> Members |
public int Compare(RadTreeNode x, RadTreeNode y) |
{ |
return y.Text.CompareTo(x.Text); |
} |
#endregion |
} |
public Form1() |
{ |
InitializeComponent(); |
this.radComboBox1.SelectedIndex = 0; |
this.radTreeView1.AllowMultiselect = true; |
this.SelectedControl = this.radTreeView1; |
this.checkImagesInFill.Text = "Highlight Node Text including its image"; |
this.radTreeView1.RadTreeNodeComparer = new ReverseSortComparer(); |
} |
I hope that helps. If you have any additional questions, please write us.
Kind regards,
Jordan
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Hello Santiago,
Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out.
For more information about this release, please refer to this blog post.
All the best,
Stefan
the Telerik team
Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out.
For more information about this release, please refer to this blog post.
All the best,
Stefan
the Telerik team
0
Dipak
Top achievements
Rank 1
answered on 17 Nov 2012, 01:06 AM
I am using Q2 SP1 2012. I want to sort a tree view where one node with Text " should display as Last node. I want to sort only ascending.I want to try above custom comparer but now that property is not available with this version.
Could you please guide me how can I achieve this?
Thanks
Dipak
Could you please guide me how can I achieve this?
Thanks
Dipak
0
Dipak
Top achievements
Rank 1
answered on 19 Nov 2012, 03:23 PM
I am using Q2 SP1 2012. I want to sort a tree view where one node with Text " should display as Last node. I want to sort only ascending.I want to try above custom comparer but now that property is not available with this version.
Could you please guide me how can I achieve this?
Thanks
Dipak
Could you please guide me how can I achieve this?
Thanks
Dipak
0
Hi Dipak,
Thank you for writing.
Please refer to the following documentation article which explains how to use custom sort comparer with the latest version of the control: http://www.telerik.com/help/winforms/treeview-working-with-nodes-custom-sorting.html.
I hope this helps.
Regards,
Stefan
the Telerik team
Thank you for writing.
Please refer to the following documentation article which explains how to use custom sort comparer with the latest version of the control: http://www.telerik.com/help/winforms/treeview-working-with-nodes-custom-sorting.html.
I hope this helps.
Regards,
Stefan
the Telerik team