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.25k stars 392 forks source link

Orientation priority handling in 2D lists or grids #442

Closed hahagu closed 1 year ago

hahagu commented 2 years ago

Describe the bug In a 2D list, such as HandyControl's FlexPanel, or the UniformGrid, the position of the adorner is set by the closest element. However, in some cases, it is preferable to make horizontal plane or vertical plane take priority in terms of closest-ness.

For example, image If a user were to drag and drop a control into the cursor position, it'd be preferrable for the control to be dropped next to p8 instead of where the adorner is now. However, this is not the behavior as of now.

Is there a way to do this currently? Thanks.

To Reproduce Steps to reproduce the behavior:

  1. Create a two-dimensional grid/list.
  2. Attach the dragdrop handler.
  3. Move a drag-droppable object around to see behavior.

Desktop (please complete the following information):

punker76 commented 1 year ago

@hahagu You can implement your own drop target with the IDropTarget interface to place the dropped item always on the "last" position in the list.