KB Article A1424
Visible to All Users

How to catch the moment when a column's position is changed

Description:
I wish to respond to the position of a column being changed but I do not see an event which is triggered at this time. Any suggestions?

Answer:
You should use the DragObjectDrop event to catch the moment when an end-user moves a column to a new position. The e.DragObject parameter defines the column object being dropped. For example, here is some sample code showing how to determine the moment when a column is dropped onto the group panel:

C#
private void gridView1_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e) { if ((e.DragObject is GridColumn) && (e.DropInfo is ColumnPositionInfo) && ((e.DropInfo as ColumnPositionInfo).InGroupPanel)) { ... // your code is here } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.