I’m following Bea Stollnitz’s blog post on implementing drag and drop on an data bound ItemsControl. It works very nicely, but I have a question for anyone who’s experienced something similar…
When I begin dragging the item, there is a small, dashed rectangle at the bottom of the mouse. I cannot figure out at all how to hide that rectangle. Does anyone know how to get rid of this? I would add a screenshot, but when I do a Print Screen, the rectangle doesn’t appear.
I think it has something to do with a focus setting on the AdornerLayer that the “DraggedAdorner” is added to.
Thanks!
Try this in the
Styleof theVisualthat is surrounded by the rectangle:EDIT: The effect that you are seeing is a result of the
DragDropEffects.Moveassignment. You can mitigate this visual by simply changing the following line (Line #168 in the sample):To this:
Thus setting the DragDropEffect to DragDropEffects.None
NOTE: In the sample, it evaluates the
DragDropEffectsvalue in the process of performing the drag & drop, so you would need to work around this (Probably a simpleAttachedProperty, or even casting theSenderas aFrameworkElementand using theTagproperty), but this should resolve the visual issue.I hope this helps, and if I can help you further feel free to let me know. Good luck!