How To Disable Row Drag Popup Based On The Drop Position In WPF Treegrid(Sftreegrid)?

Sample date Updated on Feb 15, 2024
drag-and-drop drag-drop drop-position rowdragdrop treegrid wpf

About the sample

This sample illustrates how to disable row drag popup based on the drop position in WPF TreeGrid(SfTreeGrid).

WPF TreeGrid (SfTreeGrid), will display a popup while dragging the rows in which the drop status and the dragging rows count will be displayed. You can disable this popup based on some condition by using TreeGrid.RowDragDropController.DragOver event.

private void OnRowDragDropController_DragOver(object sender, TreeGridRowDragOverEventArgs e)
{
    if (e.DropPosition == Syncfusion.UI.Xaml.TreeGrid.DropPosition.DropAbove)
    {
        e.ShowDragUI = true;
    }
    else
    {
        e.ShowDragUI = false;
        var popup = (Popup)this.treeGrid.RowDragDropController.GetType().GetField("dragpopup", System.Reflection.BindingFlags.NonPublic |
            System.Reflection.BindingFlags.Instance).GetValue(this.treeGrid.RowDragDropController);
        popup.IsOpen = false;
    }
}

KB article - How to disable row drag popup based on the drop position in WPF TreeGrid(SfTreeGrid)?

Requirements to run the demo

Visual Studio 2015 and above versions

Up arrow