I’m trying to drag an item between two Groups in the same ListView called ‘listTasks’.
Private Sub listTasks_ItemDrag(ByVal sender As Object, ByVal e As ItemDragEventArgs) Handles listTasks.ItemDrag
listTasks.DoDragDrop(listTasks.SelectedItems, DragDropEffects.Move)
End Sub
Private Sub listTasks_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs) Handles listTasks.DragEnter
e.Effect = DragDropEffects.Move
End Sub
Private Sub listTasks_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles listTasks.DragDrop
' how do I tell what group is being dropped into?
End Sub
(note that listTasks_DragEnter ignores DataFormat checks to simplify example)
With listTasks.PointToClient(New Point(e.X, e.Y)) you could use listTasks.GetItemAt(p.X, p.Y) to get the ListView item you’re over. Is there something like this for Groups? Or perhaps a better way to determine what group is the target of a drag-drop?
You can try something like this :
You will probably want to do some more work to place it at a specific place in the group, but this should get you started.