void InitializeDragOperation(ListViewItem itemToDrag) { // Set some flags used during the drag operation. this.IsDragInProgress = true; this.canInitiateDrag = false; // Let the ListViewItem know that it is being dragged. ListViewItemDragState.SetIsBeingDragged(itemToDrag, true); }
void FinishDragOperation(ListViewItem draggedItem, AdornerLayer adornerLayer) { // Let the ListViewItem know that it is not being dragged anymore. ListViewItemDragState.SetIsBeingDragged(draggedItem, false); this.IsDragInProgress = false; if (this.ItemUnderDragCursor != null) { this.ItemUnderDragCursor = null; } // Remove the drag adorner from the adorner layer. if (adornerLayer != null) { adornerLayer.Remove(this.dragAdorner); this.dragAdorner = null; } }