punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetClosest method doesn't handle nested elements

faeriedust opened this issue · comments

In the vertical search case, it condenses each of the "hits" above and below it into single points and finds the closest one to the position and returns that element.

However, this is not correct in the case that there are nested elements above/below it.

It should return the one with a nearest edge to the position at the very worst.

My example:
I have a ListView of Jobs where each ListViewItem is an inner ListView of Tasks.
If I click below the lowest Job, I would expect the FindClosest Method to be returning the lowest Job.
However, if there is a task inside that job, and directly above the clicked position, the Task will be returned instead because it is "lower" than the job that it's nested inside.

Possible fix is to take item size into account to find the nearest border and find the distance from that?

@faeriedust This should be fixed with f877268