Home Forums WinForms controls Xceed Grid for WinForms Allow columns reorder and column drag and drop in the same time

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17741 |

    Hi,

    I need to be able to drag and drop columns in/from the grid (from/in a list with available columns). In the same time, I need the drag and drop functionality of reordering the columns be available. If I enable the column DnD from the  grid into the list, the reordering of columns feature is lost, though ColumnManagerRow.AllowColumnReorder is set to true.

    This is the code I use to start the DnD operation from the Grid into the list:

    void ColumnManagerRow_cell_MouseDown(object sender, MouseEventArgs e)
            {
                _mouseLocation = new Point(e.X, e.Y);
            }

            void ColumnManagerRow_cell_MouseUp(object sender, MouseEventArgs e)
            {
                _mouseLocation = Point.Empty;
            }

            void ColumnManagerRow_cell_MouseMove(object sender, MouseEventArgs e)
            {
                if (_mouseLocation != Point.Empty)
                {
                    if (Math.Abs(_mouseLocation.X – e.X) > 3 || Math.Abs(_mouseLocation.Y – e.Y) > 3)
                    {
                        Xceed.Grid.Column column = ((Cell)sender).ParentColumn;
                        DataObject data = new DataObject(column);

                        gridPreview.DoDragDrop(data, DragDropEffects.Move);
                       
                        _mouseLocation = Point.Empty;
                    }
                }
            }

     If I comment the line “gridPreview.DoDragDrop(data, DragDropEffects.Move);” the DnD columns reorder functionality is back.

    Anyone can help me with a tip or workaround to this?I really need both operations available in the same time.

    Thanks.

     

    Imported from legacy forums. Posted by bogdip (had 1444 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi bogdip,

    The ability to support both Column Reordering and another custom Drag/Drop operation at the same is not possible.

    If Column Reordering is enabled, it already triggers a Drag/Drop operation, but only the GroupByRow or another position in the ColumnManagerRow are valid drop locations. You would have to know which of the two operations the user wants to do at the moment he clicks on the header in order to choose which Drag/Drop operation gets triggered.

    Imported from legacy forums. Posted by Diane [Xceed] (had 774 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.