Imports Infragistics.Win Imports Infragistics.Win.Layout Imports Infragistics.Win.UltraWinTree Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim rootColumnSet As UltraTreeColumnSet = Me.ultraTree1.ColumnSettings.RootColumnSet rootColumnSet.Columns("CompanyName").SortComparer = New CustomSortComparer() End Sub Public Class CustomSortComparer Implements IComparer Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare Dim cellX As UltraTreeNodeCell = x Dim cellY As UltraTreeNodeCell = y Dim stringX As String = cellX.Text Dim stringY As String = cellY.Text stringX = stringX.Replace("(", String.Empty) stringX = stringX.Replace(")", String.Empty) stringY = stringY.Replace("(", String.Empty) stringY = stringY.Replace(")", String.Empty) Return stringX.CompareTo(stringY) End Function End Class
using Infragistics.Win; using Infragistics.Win.Layout; using Infragistics.Win.UltraWinTree; using System.Diagnostics; private void button1_Click(object sender, System.EventArgs e) { UltraTreeColumnSet rootColumnSet = this.ultraTree1.ColumnSettings.RootColumnSet; rootColumnSet.Columns["CompanyName"].SortComparer = new CustomSortComparer(); } public class CustomSortComparer : IComparer { int IComparer.Compare( object x, object y ) { UltraTreeNodeCell cellX = x as UltraTreeNodeCell; UltraTreeNodeCell cellY = y as UltraTreeNodeCell; string stringX = cellX.Text; string stringY = cellY.Text; stringX = stringX.Replace( "(", string.Empty ); stringX = stringX.Replace( ")", string.Empty ); stringY = stringY.Replace( "(", string.Empty ); stringY = stringY.Replace( ")", string.Empty ); return stringX.CompareTo( stringY ); } }