Make FlexGrid.DraggedRow not do its default function

Posted by: ydolapchiev on 23 October 2020, 2:01 am EST

  • Posted 23 October 2020, 2:01 am EST

    Greetings,

    I am trying to use the
    DraggedRow
    event for
    FlexGrid
    to do my own custom function, but I cannot make the default function not execute as well. I tried using
    e.Cancel = true;
    but that seems to do nothing. When debugging the handler, everything works perfectly until the end of the handler and then when it ends, the default drag happens over my modified data and breaks the whole grid. Here is what I am trying to do:

    private void ExpressionGrid_DraggingRow(object sender, CellRangeEventArgs e)
    {
    if (!nowDragging)
    {
    nowDragging = true;
    startingDragRow = e.Row;
    movedItem = expressionList[startingDragRow];
    }
    }
    private void ExpressionGrid_DraggedRow(object sender, CellRangeEventArgs e)
    {
    e.Cancel = true;
    expressionList.Insert(e.Row, movedItem);
    expressionList.RemoveAt(startingDragRow+1);
    foreach (ExpressionEntry item in expressionList)
    {
    item.ID = expressionList.IndexOf(item);
    }
    e.Cancel = true;
    }


    I am rewriting my
    ItemsSource
    every time a drag occurs. I would like to either be able to cancel the default function, or alternatively, to write my code to execute after the default function finishes because currently the default move happens last and makes the whole event handler useless.
  • Marked as Answer

    Replied 26 October 2020, 8:09 am EST

    Hello,

    Can you please try to use C1DragDropManager and handle the ItemsSource task in the DragDrop event. Please refer attached application for drag drop implementation using C1DragDropManager.

    Regards,
    Ruchir
    DraggedRow_WPF.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels