2011-02-08 19 views

Odpowiedz

22

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

Wystarczy ustawić wskaźnik sortowania (kolejność jest istotna), kod zaczerpnięte z wyżej linku:

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); 

Więcej informacji na sekundę metodę można znaleźć tutaj: http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v8.2~Infragistics.Win.UltraWinGrid.SortedColumnsCollection~Add.html

+0

dzięki niestety linki przewidziane jest nieważne – Xander

+0

@Xander tak, Wygląda na to, że zmienili stronę i nie dodali żadnych przekierowań. To nie jest ten sam, o którym mowa powyżej, ale wygląda na to, że ma artykuł na temat sortowania, który można znaleźć tutaj: http: //www.infragistics.com/help/topic/ED043A4B-031A-48A8-8A20-9BEA498DE71A Jednak, opublikowane rozwiązanie jest nadal aktualne. – theChrisKent

+0

Dzięki, proste i pomocne rozwiązanie – Rice

2

Jeżeli również grupa chciała automatycznie przez ContactName to może zrobić dla Ciebie:

band.SortedColumns.Add("ContactName", false, true); 

wykorzystanie Zawiadomienie o prawdziwym jako ostatni parametr

Powiązane problemy