I have an explorer like tree which is bound to a datasource. I want to be able to sort by something other than the text of the node. For example, I have a "NodeType" field and the value is either Folder or File. I want all Folders to be on top, and for a bonus, files sorted by FileName (which is the text of the node) ascending.
I have heard there is a SortComparer thing that I can do but do not have any examples for it. Can someone help out with this? Also, is it possible to tell the tree or the sort comparer to Sort by NodeType first and then by FileName?
Thanks.
Here is an example compare function that I use
}
public int Compare(object x, object y) {
UltraTreeNodeCell cellY = y as UltraTreeNodeCell;
UltraTreeNode nodeY = y as UltraTreeNode;
nodeX = cellX.Node;
nodeY = cellY.Node;
//
// If the ALI object is null, then it is a folder.
// We want folder to be sorted on the top and ALI objects to be sorted on the bottom.
return -1;
#endregion