Hi,
I'm using the grid in RowLayout mode. When I drag the column header, in the DragOver event handler I check if the column header can be dropped at the current position and set an appropriate effect from DragDropEffects enum.
When I stop dragging in an invalid position (and DragDropEffect.None effect is active) the column header that has been dragging stays at the position where I left it - just hanging over the grid.
What should I do to remove that hanging column header?
Thanks,
Vitaly
I've discovered the same issue. My application uses drag modifier (the Alt key). When key is pressed, user can swap columns. Otherwise, standard drag operation occurs, allowing to drag columns to other controls. The code is as follows:
private void mygrid_SelectionDrag(object sender, System.ComponentModel.CancelEventArgs e){
bool ingrid = !(Helpers.GetAsyncKeyState(0x12) == 0); // is Alt pressed?
if (!ingrid) { gridLinia.DisplayLayout.Override.AllowColMoving = AllowColMoving.NotAllowed; gridLinia.DoDragDrop(gridLinia.Selected.Columns, DragDropEffects.Move); } else gridLinia.DisplayLayout.Override.AllowColMoving = AllowColMoving.Default;
}
It took some time to figure it out, but looks like it works as I wanted to.
Regards,
E.Butusov