Below are the steps to achieve the same
1. Adding using/imports directives
VB:
Imports Infragistics.Win.UltraWinGrid
C#:
using Infragistics.Win.UltraWinGrid;
2. The InitializeLayout event of UltraGrid sets the default HeaderClickAction for all bands and all columns
VB:
Private Sub UGSort_InitializeLayout(ByVal sender As Object, _
ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) _
Handles UGSort.InitializeLayout
e.Layout.Override.HeaderClickAction = HeaderClickAction.SortSingle
End Sub
C#:
private void UGSort_InitializeLayout(object sender,
Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
e.Layout.Override.HeaderClickAction = HeaderClickAction.SortSingle;
}
3. The code in the Button Click event instructs the UltraWinGrid to sort on band 1 column 2 in Descending order
Visual Basic:
Private Sub btnSortBand1Column2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSortBand1Column3.Click
Me.UltraGrid1.DisplayLayout.Bands(1).Columns(2).SortIndicator = _
SortIndicator.Descending
End Sub
C#:
private void btnSortBand1Column2_Click(object sender, EventArgs e)
{
this.ultraGrid1.DisplayLayout.Bands[1].Columns[2].SortIndicator =
SortIndicator.Descending;
}