'Declaration Public Property SortIndicator As SortIndicator
public SortIndicator SortIndicator {get; set;}
The UltraGrid can automatically sort the contents of columns without the addition of any code. While the UltraGrid can sort the data in columns automatically, it also gives you tools to implement your own sorting behavior through code.
Column headers can display a sort indicator in a column's header. When clicked and the HeaderClickAction property is set to HeaderClickAction.SortSingle or HeaderClickAction.SortMulti, the SortIndicator property is set to specify the order in which the column should be sorted, and the column is added to a special Columns collection just for sorted columns. If automatic sorting is disabled, in addition to adding the column to the Columns collection accessed by SortedCols, the control fires the BeforeSortChange and AfterSortChange events so that you can examine the contents of the collection, check the value of the SortIndicator property of each column, and perform the sort.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button22_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button22.Click Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0) ' Sort the rows by Country and City fields. Notice the order in which these columns ' are set. We want to sort by Country and then sort by City and in order to do that ' we have to set the SortIndicator property in the right order. band.Columns("Country").SortIndicator = SortIndicator.Ascending band.Columns("City").SortIndicator = SortIndicator.Ascending ' To sort multi-column using SortedColumns property ' This enables multi-column sorting this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti ' It is good practice to clear the sorted columns collection band.SortedColumns.Clear() ' You can sort (as well as group rows by) columns by using SortedColumns ' property off the band band.SortedColumns.Add("ContactName", False, False) End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button22_Click(object sender, System.EventArgs e) { UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0]; // Sort the rows by Country and City fields. Notice the order in which these columns // are set. We want to sort by Country and then sort by City and in order to do that // we have to set the SortIndicator property in the right order. band.Columns["Country"].SortIndicator = SortIndicator.Ascending; band.Columns["City"].SortIndicator = SortIndicator.Ascending; // To sort multi-column using SortedColumns property // This enables multi-column sorting this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti; // It is good practice to clear the sorted columns collection and.SortedColumns.Clear(); // You can sort (as well as group rows by) columns by using SortedColumns // property off the band band.SortedColumns.Add( "ContactName", false, false ); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2