How to: Customize the Standard Column Header Menu
The following code sample creates a menu item that fixes the column to the left. This item is added to the column header’s context menu next to the Hide This Column item:
void gridView1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
if (e.MenuType == GridMenuType.Column) {
DXMenuItem item = new DXMenuItem("Fix/Unfix This Column", (s, args) => {
GridColumn column = (s as DXMenuItem).Tag as GridColumn;
if (column.Fixed == FixedStyle.Left)
column.Fixed = FixedStyle.None;
else column.Fixed = FixedStyle.Left;
});
item.Tag = e.HitInfo.Column;
int index = e.Menu.Items.IndexOf(e.Menu.Find(GridStringId.MenuColumnRemoveColumn));
e.Menu.Items.Insert(index + 1, item);
}
}
Refer to the following help topic for more information: Modify Built-In Context Menus.