usingSystem;usingSystem.ComponentModel;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingSystem.Text;usingDevexpress.expressapp;usingDevExpress.ExpressApp.Actions;usingDevExpress.Persistent.Base;usingDevExpress.ExpressApp.Win.Editors;usingDevExpress.XtraGrid.Views.Grid;usingDevExpress.XtraGrid.Columns;usingDevExpress.Utils.Menu;usingDevExpress.XtraGrid.Menu;usingSystem.Drawing;usingDevExpress.ExpressApp.Utils;namespaceE1554. module{ Public Partial classFixclomunviewcontroller:viewcontroller<listview> { PublicFixclomunviewcontroller () {InitializeComponent (); } protected Override voidondeactivated () {Base. Ondeactivated (); } protected Override voidonviewcontrolscreated () {Base. Onviewcontrolscreated (); //Access and customize the target View control.Gridlisteditor ListEditor = ((ListView) View). Editor asGridlisteditor; if(ListEditor! =NULL) {Xafgridview GridView= Listeditor.gridview asXafgridview; Gridview.popupmenushowing+=NewPopupmenushowingeventhandler (gridview_popupmenushowing); } } Private voidGridview_popupmenushowing (Objectsender, Popupmenushowingeventargs e) { if(E.menutype = =DevExpress.XtraGrid.Views.Grid.GridMenuType.Column) {DevExpress.XtraGrid.Menu.GridViewColu Mnmenu Menu= E.menu asGridviewcolumnmenu; if(menu. Column! =NULL) { //Adding New ItemsDxpopupmenu Popmenu =NewDxpopupmenu (); Popmenu.caption="Frozen List"; Menu. Items.Add (Popmenu); POPMENU.ITEMS.ADD (Createcheckitem ("Cancel", menu. Column, Fixedstyle.none, ImageLoader.Instance.GetImageInfo ("notfixed"). Image)); POPMENU.ITEMS.ADD (Createcheckitem ("left side", menu. Column, Fixedstyle.left, ImageLoader.Instance.GetImageInfo ("Fixedleft"). Image)); POPMENU.ITEMS.ADD (Createcheckitem ("Right side", menu. Column, Fixedstyle.right, ImageLoader.Instance.GetImageInfo ("Fixedright"). Image)); } } } //Create a menu itemDxmenucheckitem Createcheckitem (stringcaption, gridcolumn column, Fixedstyle style, image image) {Dxmenucheckitem Item=NewDxmenucheckitem (caption, column. Fixed = =style, image,NewEventHandler (Onfixedclick)); Item. Tag=Newmenuinfo (column, style); returnitem; } //Menu Item Click handler voidOnfixedclick (Objectsender, EventArgs e) {Dxmenuitem Item= Sender asDxmenuitem; Menuinfo Info= Item. Tag asMenuinfo; if(Info = =NULL)return; Info. Column.fixed=info. Style; } //The class that stores menu specific information classMenuinfo { Publicmenuinfo (gridcolumn column, Fixedstyle style) { This. Column =column; This. Style =style; } PublicFixedstyle Style; PublicGridColumn Column; } }}
[Original] XAF ListView frozen column