I have a Ultra Tree that i have created an IComparer Class to sort the tree, but it isn't sorting the tree. I am probably doing somthing wrong, can anyone help me ?
this is what i have
This is the constructor
public ReportsViewer2()
{
InitializeComponent();
_openedFilesHash = newHashtable();
nodeTooltip = new Infragistics.Win.ToolTip ( ultraTree1 );
nodeTooltip.InitialDelay = 0;
ultraTree1.Nodes.Override.SortComparer = new ITreeNodeSortOrderComparer();
ultraTree1.Nodes.Override.Sort = SortType.Ascending;
}
and this is the IComparer class:
public class ITreeNodeSortOrderComparer :IComparer
{
publicint Compare(Object x, Object y)
{
int retVal = -1;
if (x isUltraTreeNode && y isUltraTreeNode)
{
retVal = string.Compare(((UltraTreeNode)x).Text, ((UltraTreeNode)y).Text);
}
else
{
throw (newException("Can not do a UltraTreeNode Compare on non UltraTreeNode objects."));
}
return retVal;
}
}
this is what i have
This is the constructor
public ReportsViewer2()
{
InitializeComponent();
_openedFilesHash = newHashtable();
nodeTooltip = new Infragistics.Win.ToolTip ( ultraTree1 );
nodeTooltip.InitialDelay = 0;
ultraTree1.Nodes.Override.SortComparer = new ITreeNodeSortOrderComparer();
ultraTree1.Nodes.Override.Sort = SortType.Ascending;
}
and this is the IComparer class:
public class ITreeNodeSortOrderComparer :IComparer
{
publicint Compare(Object x, Object y)
{
int retVal = -1;
if (x isUltraTreeNode && y isUltraTreeNode)
{
retVal = string.Compare(((UltraTreeNode)x).Text, ((UltraTreeNode)y).Text);
}
else
{
throw (newException("Can not do a UltraTreeNode Compare on non UltraTreeNode objects."));
}
return retVal;
}
}