如何通过编程方式对多列UltraGrid进行排序?

And*_*rei 15 .net c# infragistics ultrawingrid

假设我们有一个UltraGrid.我怎样才能先通过A列,然后是B,然后是C,以编程方式对其进行排序.

谢谢!

the*_*ent 24

文档: http ://help.infragistics.com/Help/Doc/WinForms/2011.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.UltraGridBand~SortedColumns.html

你可以设置排序指标(顺序很重要),代码来自上面的链接:

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;

// You can also sort (as well as group rows by) columns by using SortedColumns
// property off the band.
band.SortedColumns.Add( "ContactName", false, false );
Run Code Online (Sandbox Code Playgroud)

有关第二种方法的更多信息,请访问:http: //help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v8.2〜Infragistics.Win.UltraWinGrid .SortedColumnsCollection〜Add.html