Hi Nedu,
To programatically change the column position, you need to use the move method in GridTableDescriptor.VisibleColumns property. If you want to detect the drag column index at runtime then handle the TableControlQueryAllowDragColumn event in a grid. Below is a code snippet that show this.
//For move columns in a grid.
this.grid.TableDescriptor.VisibleColumns.Move(1,2);
private void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e)
{
if (e.Reason == GridQueryAllowDragColumnReason.MouseUp)
{
int insertBeforFieldIndex = e.TableControl.TableDescriptor.NameToField(e.InsertBeforeColumn);
int FieldIndex = e.TableControl.TableDescriptor.NameToField(e.Column);
if( FieldIndex < insertBeforFieldIndex )
this.gridGroupingControl2.TableDescriptor.VisibleColumns.Move( FieldIndex, insertBeforFieldIndex - 1);
else
this.gridGroupingControl2.TableDescriptor.VisibleColumns.Move( FieldIndex, insertBeforFieldIndex);
}
}
Please refer to attached sample for implementation and let me know if this helps.
DragFilterBarUserControANDMonthCalendarl.zipBest regards,
Haneef