Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
505
custom swapping columns
posted
After having implemented drag and drop in the grid, I am trying to implement swapping columns of my own.  First I need to know what the two columns are to swap.  I set e.Layout.Override.AllowColMoving = AllowColMoving.NotAllowed. I can get the column name in _MouseDown() when the mouse starts to drag.  But I cannot get the column name in _DragDrop() when it gets dropped because col returned null.  And it never triggers _MouseUp().  Can you tell me what is the right way to implement custom column swapping? It would be better if there is any code example.   private void ultraGrid1_MouseDown( object sender, MouseEventArgs e )
{
  UIElement uiEl = this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint( new Point( e.X, e.Y ) );
 
UltraGridColumn col = uiEl.GetContext( typeof( UltraGridColumn ) ) as UltraGridColumn;
  UltraGridCell cel = uiEl.GetContext( typeof( UltraGridCell ) ) as UltraGridCell;
....
}
private void ultraGrid1_DragDrop( object sender, DragEventArgs e )
{
  UIElement uiEl = this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint( new Point( e.X, e.Y ) );    // null if not on column header
  UltraGridColumn
col = uiEl.GetContext( typeof( UltraGridColumn ) ) as UltraGridColumn;
....
}