Ryan Gates
Ryan Gates

Reputation: 4539

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?

Upvotes: 0

Views: 287

Answers (1)

Gert Arnold
Gert Arnold

Reputation: 109137

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

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

Upvotes: 3

Related Questions