Search code examples
infragisticsultrawingrid

enumerate grid columns in order


I am using an UltraGrid control from Infragistics. I am able to get a strongly typed enumeration of the UltraGridColumns using the below code:

(this.grid.DisplayLayout.Bands[0].Columns).Cast<UltraGridColumn>();

How can I order this enumeration such that it is the same as in the UI? (The user is able to rearrange columns freely).

Is there a property that I can use to order by or use to sort on?


Solution

  • The order is in the headers (yeah...):

    this.grid.DisplayLayout.Bands[0].Columns).Cast<UltraGridColumn>()
        .OrderBy(c => c.Header.VisiblePosition);