'宣言 Public ReadOnly Property ItemSort As ItemSortType
public ItemSortType ItemSort {get;}
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinExplorerBar Public Class MyComparer Implements IComparer Public Sub New() End Sub Public Overridable Overloads Function Compare(ByVal obj1 As Object, ByVal obj2 As Object) As Integer Implements IComparer.Compare Dim item1 As UltraExplorerBarItem = obj1 Dim item2 As UltraExplorerBarItem = obj2 ' Do a case insensitive compare. Return String.Compare(item1.Text, item2.Text, True) End Function End Class Private Sub Button50_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button50.Click ' Set the item sort to Descending for all groups. Me.ultraExplorerBar1.GroupSettings.ItemSort = ItemSortType.Descending ' Set the item sort comparer to an instance of our custom comparer. Me.ultraExplorerBar1.GroupSettings.ItemSortComparer = New MyComparer() End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinExplorerBar; public class MyComparer : IComparer { public MyComparer() { } public int Compare(object obj1, object obj2) { UltraExplorerBarItem item1 = obj1 as UltraExplorerBarItem; UltraExplorerBarItem item2 = obj2 as UltraExplorerBarItem; // Do a case insensitive compare. return string.Compare(item1.Text, item2.Text, true); } } private void button50_Click(object sender, System.EventArgs e) { // Set the item sort to Descending for all groups. this.ultraExplorerBar1.GroupSettings.ItemSort = ItemSortType.Descending; // Set the item sort comparer to an instance of our custom comparer. this.ultraExplorerBar1.GroupSettings.ItemSortComparer = new MyComparer(); }