HeaderPane
Main
Hide
Share Link
Print

DragDetected Event, SftTree Class

Occurs when the user starts dragging an object.

Class: SftTree
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public event DragDetectedEventHandler DragDetected;
Public Event DragDetected As DragDetectedEventHandler

Comments

Occurs when the user starts dragging an object.

This event is only available when the SftTree.DragStyle property is defined to detect drag operations (DragStyleEnum.Detect).

The DragDetected event is only used to signal that the user has requested a drag & drop operation. The actual implementation of the drag & drop operation is delegated to the container, which must support drag & drop between controls.

The Handled field of the DragDetectedEventArgs class instance must be set to True, if the application performs drag & drop (usually by invoking SftTree.DoDragDrop), otherwise the tree control's built-in action (such as column reordering) will also be performed.

Examples

C#

            DumpValues("ColumnReordered", e);
        }

        private void sftTree1_ColumnResized(object sender, Softelvdm.SftTreeNET.ColumnResizedEventArgs e) {
            DumpValues("ColumnResized", e);
        }

        private void sftTree1_DragDetected(object sender, Softelvdm.SftTreeNET.DragDetectedEventArgs e) {
            DumpValues("DragDetected", e);

            if (e.Item.UsageLocation != UsageLocationEnum.items)
                return; // ignore header/footer dragging

            e.Handled = true;
            sftTree1.DoDragDrop("In this example, we are dragging a simple text string", DragDropEffects.Copy);
        }

VB.NET

Private Sub SftTree1_ColumnResized(ByVal sender As System.Object, ByVal e As Softelvdm.SftTreeNET.ColumnResizedEventArgs) Handles SftTree1.ColumnResized
 DumpValues("ColumnResized", e)
End Sub

Private Sub SftTree1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SftTree1.DoubleClick
 DumpValues("DoubleClick", e)
End Sub

Private Sub SftTree1_DragDetected(ByVal sender As System.Object, ByVal e As Softelvdm.SftTreeNET.DragDetectedEventArgs) Handles SftTree1.DragDetected
    DumpValues("DragDetected", e)

    If e.Item.UsageLocation <> UsageLocationEnum.items Then
        Return ' ignore header/footer dragging
    End If

    e.Handled = True

See Also SftTree Class | Classes | SftTree/NET 3.0