开发者

DevExpress XtraGrid: Make column visible to user

开发者 https://www.devze.com 2023-02-19 15:24 出处:网络
I have a grid with lots of columns (ca. 100). I\'ve written a column sele开发者_开发技巧ctor context menu (which has each letter of the alphabet and then as subitems all the columns beginning with tha

I have a grid with lots of columns (ca. 100). I've written a column sele开发者_开发技巧ctor 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?


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.


Use the GridColumn.VisibleIndex property to change the order in which columns are displayed.

VisibleIndex = -1 hides a column IIRC.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号