punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
BSD 3-Clause "New" or "Revised" License
2.31k stars 405 forks source link

No drop target adorner when dragging over an empty list group #474

Closed josh2112 closed 1 year ago

josh2112 commented 1 year ago

Describe the bug When dragging something over an empty group in a ListView with grouping enabled, the drop target adorner doesn't draw in the correct place.

To Reproduce Steps to reproduce the behavior:

  1. Clone my "minimum viable code sample" repository at https://github.com/josh2112/DragDropEmptyGroupTest
  2. Build & run
  3. Drag an item from Group 2 or Group 3 over the empty group (group 1)
  4. Although you can drop the item into the group, the drop target adorner does not draw there. It remains drawn next to whatever list item you were over previously.

Expected behavior Drop adorner under the empty group (between Group 1 and Group 2 labels)

Desktop (please complete the following information):

Additional context IDropInfo.TargetGroup does get populated when dragging over a group header, allowing me to complete the drop and move the item to its proper place, but with the drop target adorner being drawn in the wrong place, a user won't know that it does in fact work!

Thanks for reviewing!

punker76 commented 1 year ago

@josh2112 After investigating your issue, I found some points. First I can solve your issue, but only for the first empty group, which was added by your code behind. Second, it can't be solved in general, because the ListView doesn't allow empty groups in general! It's not support by WPF. Also in your sample, if I put some items in your group then all is fine, but if I remove the items completely then you group is gone. And then it's not possible to add a new group without any issues.

Sorry that I must say that. Maybe a TreeView with only one Level is better for you to solve this.

kind regards Jan