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.
Parameters:
| 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
ChildIndex
#InsertIndex
#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.
Value: The insertion index where the user is dragging to, otherwise -1 if dragging over an item.
IsChanged
#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.
Value:
true if is changed; otherwise, false.Item
#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
#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
#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.
Value: 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
#Restricts the drop to an item or a child within the specified number of levels.
RestrictToOver
#public void RestrictToOver()
Helper to restrict to drop on top an existing item without allowing any insertion.