-
-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong DragAdorner offset in TreeView #346
Comments
Hi punker76, i want to back Suplanus issue, because i'm struggling with the behavior also. Dragging groups with attached child items is a common requirement and the offset is challenging to the end user. I hope you will find the time to dig into the issue. Thanks and regards. |
First investigation result, I think this is a bug (or feature) in WPF. If I drag a collapsed TreeViewItem, then the captured TreeViewItem is correct. If I expand and collapse this TreeViewItem again, then the captured visual is wrong, it's the expanded descended and not the collapsed. It feels like that there is a cache mechanism. |
It's not a cache mechanism. What's happening is I happened upon this whilst trying to figure out why the I've raised a case on the official WPF repo here. In the mean time I have applied a workaround I have developed (detailed in the above case) to a separate branch, forked from I've also made alterations to I have not created a pull request for all this yet as the reflection-based workaround is fairly horrifying, although it does appear to work as desired. With that being said however, I'm not sure if there is a better way of working around this that wouldn't risk the behaviour starting to increasingly drift from the original Let me know if you do actually want me to create a pull-request with these changes, @punker76. |
…eViewItem) with our own GetVisibleDescendantBounds version Credits and idea goes to @Metritutus
@Metritutus First, really thank you for looking in to this bad issue. Indeed, reflections, ah damn :-) After looking in your code I made an alternative with some ideas from your code: https://github.com/punker76/gong-wpf-dragdrop/tree/fix/346 I changed the implementation of It would be nice if you can check this for collapsed |
@punker76 The change in my original code was general purpose, it would work for the evaluation of any I have also had a look at your change. Because you're using Looking at where you're using However, although On top of this, my understanding is that As far as I can see, the reflection solution seems to remain the best approach to this in terms of reliability and minimising functional changes. With any luck, Microsoft will come back with a positive response that either fixes this or adds a new method to In the mean time, having slept on this for a bit, I'll create a pull request with my changes for this repo. If WPF gets updated to resolve this then the reflection workaround can then be removed later. |
What steps will reproduce this issue?
dd:DragDrop.UseDefaultDragAdorner="True"
Expected outcome
No offset of the dragged items
Environment
The text was updated successfully, but these errors were encountered: