TreeGridViewDragInfo

References
Extra drag information when dragging to a TreeGridView.
Remarks: Use this information to determine where the user is dragging to, and also to change where the drag indicator will be shown by modifying the Item and ChildIndex properties.

Constructors

TreeGridViewDragInfo

#
public TreeGridViewDragInfo(TreeGridView control, object parent, object item, int? childIndex, GridDragPosition position)
Initializes a new instance of the TreeGridDragInfo class.
control (TreeGridView)The parent widget that this info belongs to
parent (object)Parent of the item dragging to.
item (object)Item user is dragging to, or null if dragging as a child of the parent node.
childIndex (int?)Index of the item relative to the parent if known, otherwise null to determine the index when requsted.
position (GridDragPosition)The position of the cursor relative to the item or parent if item is null.

Properties

Control

#
public TreeGridView Control { get; }
Gets the parent tree control this info is for.

InsertIndex

#
public int InsertIndex { get; }
Gets or sets the insertion index where the user is dragging to as a child of Item, or -1 if dragging over the Item.
Remarks: This is useful if the user is dragging between existing items, or the beginning or end of a child list.
The insertion index where the user is dragging to, otherwise -1 if dragging over an item.

IsChanged

#
public bool IsChanged { get; }
Gets a value indicating whether this TreeGridDragInfo is changed.
Remarks: This will return true if the InsertIndex or Parent have been set. This is useful for platform implementations to determine if the drop target has been modified.
true if is changed; otherwise, false.

Item

#
public object Item { get; set; }
Gets or sets the item to drag to, or null if dragging below the Parent node.
Remarks: This specifies the target item to drag to. Note that if Position is Before or After, then you should use InsertIndex to insert the nodes at that specified location. If you do not want to allow inserting, use RestrictToOver() in the Control.DragOver event, or you can also use RestrictToInsert() to only allow inserting items.

Parent

#
public object Parent { get; set; }
Gets or sets the parent node of the Item to drag to.
Remarks: Normally you would only need to set Item to specify which node to drag to. However, in the case of dragging to below the Parent as inserting a first child you would set Parent to the node, Item to null, and Position to GridDragPosition.After.

Position

#
public GridDragPosition Position { get; set; }
Gets a value indicating whether the drop should insert before, after, or over the Item.
Remarks: When this is Before or After, you can use the InsertIndex to determine what index to insert the item as a child of the Parent node.
The position to insert the dropped item, or over.

Methods

RestrictToInsert

#
public void RestrictToInsert()
Helper to restrict the drop to insert items only without allowing draging over existing items.

RestrictToNode

#
public bool RestrictToNode(object item, int childLevels = -1)
Restricts the drop to an item or a child within the specified number of levels.
item (object)Item to restrict the drop to, or any of its children
childLevels (int = -1)Number of child levels to allow, or -1 to allow any number of levels
True if the drag was restricted, or false if the user is already dragging over the specified item or its children.

RestrictToOver

#
public void RestrictToOver()
Helper to restrict to drop on top an existing item without allowing any insertion.