假设我们有一个UltraGrid。 如何通过编程先按列A,然后按列B,最后按列C进行排序。
谢谢!
假设我们有一个UltraGrid。 如何通过编程先按列A,然后按列B,最后按列C进行排序。
谢谢!
您可以只设置排序指示器(顺序很重要),代码来源于上述链接:
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 );
band.SortedColumns.Add( "ContactName", false, true);
注意将true作为最后一个参数使用