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.28k stars 400 forks source link

DropTargetAdorners.Highlight has wrong location #449

Closed RedX2501 closed 2 years ago

RedX2501 commented 2 years ago

Describe the bug When you have non-visible elements the Highlight border is misaligned.

To Reproduce Steps to reproduce the behavior:

Open project, drag element onto target element.

DragDropBugReport.zip

This project uses the latest version with .net 6 but I have the problem with .net framework 4.7.2.

Expected behavior The highlight border should be around the gray element but is offset.

The computation of the size to highlight is correct but the offset is not.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

RedX2501 commented 2 years ago

I do realize that a workaround exists by moving the dd:IsDropTarget to the border.

I do still think this is a problem since there is a code to calculate the accurate size of the target but the offset is not considered.

punker76 commented 2 years ago

@RedX2501 The problem here was that the target UserControl doesn't set a Background brush (like Transparent) to use the entire bounds. So the result is then the wrong position for the inner bounds. Workaround is to set the Background, but I also fixed that now.