Reputation: 1789
I have a grid with lots of columns (ca. 100). I've written a column selector context menu (which has each letter of the alphabet and then as subitems all the columns beginning with that letter).
When the user clicks in the context menu I want to make the column they have chosen visible to the user (preferably in the middle of the visible grid). I don't want to actually mess with the column order, I just want to make sure a column is visible to the user.
Any ideas?
Upvotes: 0
Views: 4576
Reputation: 11366
This can be done using the following approach:
1) set the column's Visible property to true.
2) if you want this column to be in the middle of the grid, set its VisibleIndex property to gridView.VisibleColumnsCount / 2;
3) call the GridView's MakeColumnVisible method to make this column visible to the end user.
Upvotes: 2
Reputation: 124686
Use the GridColumn.VisibleIndex property to change the order in which columns are displayed.
VisibleIndex = -1 hides a column IIRC.
Upvotes: 1