Core Library for WPF | ComponentOne
Core Library / DragDropManager / DragDrop Behavior
In This Topic
    DragDrop Behavior
    In This Topic

    DragDropManager provides a highly flexible collection of events, methods and properties for executing drag and drop operations in applications. The DragDropManager basically uses two classes for drag-drop events, methods and properties: C1DragDropManager and DragDropEventArgs.

    Drag and Drop Events

    The drag-and-drop processes using DragDropManager are basically event-driven. Both the drop target and drag source use a set of events to handle the drag and drop procedures.

    Events Description
    DragDrop The DragDrop event is used at the end of a drag-drop process, when the user releases the mouse button on a registered drop target.
    DragEnter The DragEnter event is used during a drag-drop process, when the cursor enters a registered drop target.
    DragLeave The DragLeave event is used during a drag-drop process, when the cursor leaves a registered drop target.
    DragOver The DragOver event is used during a drag-drop process, when the cursor moves over a registered drop target.
    DragStart The DragStart event is used when a drag drop process begins.
    DragAutoScroll The DragAutoScroll fires after the C1DragDropManager automatically scrolls a ScrollViewer control in order to keep the drop location within view.

    Drag and Drop Methods

    DragDropManager uses a set of methods to execute drag-drop procedures.

    Methods Description
    RegisterDragSource The RegisterDragSource method registers a UIElement to act as a drag source. This method passes three parameters, source, effect and keys. The source parameter is a UIElement that will act as a drag source. The effect parameter provides the DragDropEffect that will be supported by the source object. The keys parameter indicates the ModifierKeys that should be pressed in order for the drag operation to start.
    RegisterDropTarget The RegisterDropTarget method registers (or un-registers) an element as a drop target. This method passes two parameters, target and register. Here, target can be a UIElement that will act as a drop target, while the register parameter can be used to register or un-register the UIElement.
    UnregisterDragSource The UnregisterDragSource un-registers a UIElement as a drag source.
    ClearSources The ClearSources method removes all the registered sources.
    ClearTargets The ClearTargets method removes all the registered targets.

    Drag and Drop Properties

    DragDropManager uses a set of properties for drag source, drop target, scrollviewer etc.

    Properties Description
    DragSource The DragSource property gets the UIElement that is acting as a drag source.
    DropTarget The DropTarget property gets the UIElement that is acting as a drop target.
    Effect

    The Effect property gets or sets the DragDropEffect enumeration that will be applied when the user drops the DragSource element into the element. The drag source can be either copied or moved into a drop target element.

    ScrollViewer The ScrollViewer property gets or sets the DragDropEventArgs.ScrollViewer that will scroll automatically during the drag drop operation when the mouse is near its edge. Note that by default, C1DragDropManager selects the ScrollViewer by default.
    DragThreshold The DragThreshold property determines the drag behavior of the drag source. It gets or sets the distance in pixels that the mouse must move before a drag operation starts. 
    SourceMarker The SourceMarker property gets a reference to the border used to highlight the drag source.
    TargetMarker The TargetMarker property gets the border used to indicate the drop target.

    The subtopic Drag Markers discuss about markers, which appear during the drag-and-drop process at the source and target.