WinForms

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TreeViewAdvDragHighlightTracker

    Show / Hide Table of Contents

    Class TreeViewAdvDragHighlightTracker

    Represents the drag and drop UI helper class of TreeViewAdv.

    Inheritance
    System.Object
    TreeViewAdvDragHighlightTracker
    Implements
    System.IDisposable
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Windows.Forms.Tools
    Assembly: Syncfusion.Tools.Windows.dll
    Syntax
    public class TreeViewAdvDragHighlightTracker : IDisposable, ITreeNodeAdvPaintFilter
    Remarks

    Use this class (will be referred to as "tracker" below) only when you want to support dropping adjacent (above or below) to a node. Otherwise simply listen to the System.Windows.Forms.Control.DragOver and System.Windows.Forms.Control.DragDrop events and provide/use the . When used, this tracker will draw indicators above or below a node while dragging an item over the node. The tracker needs to be updated as shown below in the DragXXX events.

    The usage semantics for the tracker is as follows:

    1. Create an instance of this class and listen to the QueryAllowedPositionsForNode event.
    2. In the TreeViewAdv's DragOver event update the highlighted node with a call to the SetHighlightNode(TreeNodeAdv, Point) method.
    3. In the TreeViewAdv's DragLeave event clear the highlighted node with a call to the ClearHighlightNode() method.
    4. In the QueryAllowedPositionsForNode event handler, specify whether a computed adjacent position should be allowed.
    5. In the TreeViewAdv's DragDrop event get the highlighted node and the drop-position from the tracker and insert the new node(s) accordingly.
    Examples

    Please take a look at our sample in the ..\Essential Tools\Samples\Tree Package\TreeViewAdvDragDrop folder for more information.

    Constructors

    TreeViewAdvDragHighlightTracker(TreeViewAdv)

    Initialize a new instance of the TreeViewAdvDragHighlightTracker class.

    Declaration
    public TreeViewAdvDragHighlightTracker(TreeViewAdv tree)
    Parameters
    Type Name Description
    TreeViewAdv tree

    The TreeViewAdv instance where drag-and-drop will occur.

    Properties

    DropPosition

    Gets the computed drop-position around the highlight node.

    Declaration
    public TreeViewDropPositions DropPosition { get; }
    Property Value
    Type Description
    TreeViewDropPositions

    EdgeSensitivity

    This property will soon be replaced by the and properties, please use them instead.

    Declaration
    [Obsolete("This property will soon be replaced by the EdgeSensitiviyOnTop and EdgeSensitiviyAtBottom properties, please use them instead.")]
    public int EdgeSensitivity { get; set; }
    Property Value
    Type Description
    System.Int32

    Default is zero.

    EdgeSensitivityAtBottom

    Gets or sets a height for the bottom edge of a node while dragging over.

    Declaration
    public int EdgeSensitivityAtBottom { get; set; }
    Property Value
    Type Description
    System.Int32

    Default is -1.

    Remarks

    By default (when value is negative), the bottom 1/3 of the node will be considered the bottom edge. This value will be used when you allow dropping below a node using the AllowedPositions property. Set this to zero if you never want to drop below a node.

    EdgeSensitivityOnTop

    Gets or sets a height for the top edge of a node while dragging over.

    Declaration
    public int EdgeSensitivityOnTop { get; set; }
    Property Value
    Type Description
    System.Int32

    Default is -1.

    Remarks

    By default (when value is negative), the top 1/3 of the node will be considered the top edge. This value will be used when you allow dropping before a node using the AllowedPositions property. Set this to zero if you never want to drop on top of a node.

    HighlightNode

    Gets the node over which the mouse is hovering for drop.

    Declaration
    public TreeNodeAdv HighlightNode { get; }
    Property Value
    Type Description
    TreeNodeAdv

    WaitTimeBeforeExpand

    Gets or sets the time interval after which a node will be expanded on mouse hover during drag and drop.

    Declaration
    public int WaitTimeBeforeExpand { get; set; }
    Property Value
    Type Description
    System.Int32

    Time in milliseconds. Default is 750.

    Remarks

    If you do not want a node to expand on drag over, set this value to -1.

    Methods

    ClearHighlightNode()

    Clears the current highlight node setting.

    Declaration
    public void ClearHighlightNode()
    Remarks

    Call this method from the TreeViewAdv's DragLeave and DragDrop(after you get the highlight information from the tracker class) events.

    SetHighlightNode(TreeNodeAdv, Point)

    Sets the node over which the mouse is currently hovering during drag-drop.

    Declaration
    public void SetHighlightNode(TreeNodeAdv highlightNode, Point ptInTree)
    Parameters
    Type Name Description
    TreeNodeAdv highlightNode

    The new highlight node.

    System.Drawing.Point ptInTree

    The point in tree where the mouse is in the tree view's client co-ordinates.

    Remarks

    Call this method from the TreeViewAdv's DragOver method.

    Events

    QueryAllowedPositionsForNode

    Occurs before drawing a highlight indicator above or below a node.

    Declaration
    public event QueryAllowedPositionsEventHandler QueryAllowedPositionsForNode
    Event Type
    Type Description
    QueryAllowedPositionsEventHandler
    Remarks

    You can listen to this event and prevent drawing highlights for some specific nodes.

    QueryDragInsertInfo

    Occurs before drawing a DragInsert position.

    Declaration
    public event QueryDragInsertInfoEventHandler QueryDragInsertInfo
    Event Type
    Type Description
    QueryDragInsertInfoEventHandler
    Remarks

    You can listen to this event and change DragInsert highlight color.

    Explicit Interface Implementations

    IDisposable.Dispose()

    Declaration
    void IDisposable.Dispose()

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved