Class TreeViewAdvDragHighlightTracker
Represents a data for the TreeViewAdv Drag and Drop UI helper class.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools.MultiColumnTreeView
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 System.Windows.Forms.DropEffect. 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:
- Create an instance of this class and listen to the QueryAllowedPositionsForNode event.
- In the MultiColumnTreeView's DragOver event update the highlighted node with a call to the SetHighlightNode(TreeNodeAdv, Point) method.
- In the MultiColumnTreeView's DragLeave event clear the highlighted node with a call to the ClearHighlightNode() method.
- In the QueryAllowedPositionsForNode event handler, specify whether a computed adjacent position should be allowed.
- In the MultiColumnTreeView'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(MultiColumnTreeView)
Initializes a new instance of the TreeViewAdvDragHighlightTracker class.
Declaration
public TreeViewAdvDragHighlightTracker(MultiColumnTreeView tree)
Parameters
Type | Name | Description |
---|---|---|
MultiColumnTreeView | tree | The MultiColumnTreeView 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 |
---|
TreeViewDropPositions |
EdgeSensitivity
Gets or sets the value of EdgeSensitivity.
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. |
Remarks
This property will soon be replaced by the EdgeSensitiviyOnTop and EdgeSensitiviyAtBottom properties, please use them instead.
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 |
---|
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 |
---|
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 |
---|
QueryDragInsertInfoEventHandler |
Remarks
You can listen to this event and change DragInsert highlight color.
Explicit Interface Implementations
IDisposable.Dispose()
Declaration
void IDisposable.Dispose()