protected override void OnItemDrag(ItemDragEventArgs e) { // if the item wasn't even properly clicked on, don't start a drag if (!_clickedNodeWasInBounds) { return; } base.OnItemDrag(e); // Call dragstart event if (DragStart != null) { DragStartEventArgs ea = new DragStartEventArgs(); ea.Nodes = SelectedNodes; DragStart(this, ea); if (ea.CancelDrag) { return; } } DrawSelectedNodesAsDragSource(); // Start drag drop DoDragDrop(SelectedNodes, DragDropEffects.All); }
void treeview_DragStart(object sender, DragStartEventArgs e) { e.CancelDrag = !AllowDragging; }