Skip to content
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

Highlight adorner outlines too much when TreeView item is collapsed #39

Closed
punker76 opened this issue Feb 18, 2013 · 2 comments
Closed

Comments

@punker76
Copy link
Owner

Original author: neilboyd (October 11, 2011 15:12:39)

What steps will reproduce the problem?

  1. Change the DefaultDropHandler to use DropTargetAdorners.Highlight instead of DropTargetAdorners.Insert (an easy way to demonstrate the issue)
  2. Run the DefaultsExample
  3. Select the Bound TreeViews tab
  4. Expand Root1
  5. Collapse Root1
  6. Expand Root2
  7. Drag Item10 over Root1

What is the expected output? What do you see instead?
You will see that the highlight outline covers the space that Root1 did have when it was expanded.
It should only cover the now collapsed space.

What version of the product are you using? On what operating system?
Revision 38. Windows XP.

Please provide any additional information below.
Patch to fix it is attached.

Original issue: http://code.google.com/p/gong-wpf-dragdrop/issues/detail?id=39

@punker76
Copy link
Owner Author

Index: GongSolutions.Wpf.DragDrop/DropTargetHighlightAdorner.cs
===================================================================
--- GongSolutions.Wpf.DragDrop/DropTargetHighlightAdorner.cs    (revision 38)
+++ GongSolutions.Wpf.DragDrop/DropTargetHighlightAdorner.cs    (working copy)
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
+using System.Windows;
 using System.Windows.Media;

 namespace GongSolutions.Wpf.DragDrop
@@ -13,14 +9,14 @@
             : base(adornedElement)
         {
         }
-        
+
         protected override void OnRender(DrawingContext drawingContext)
         {
             if (DropInfo.VisualTargetItem != null)
             {
                 Rect rect = new Rect(
                     DropInfo.VisualTargetItem.TranslatePoint(new Point(), AdornedElement),
-                    VisualTreeHelper.GetDescendantBounds(DropInfo.VisualTargetItem).Size);
+                    DropInfo.VisualTargetItem.DesiredSize);
                 drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Gray, 2), rect, 2, 2);
             }
         }

@ghost ghost assigned punker76 Mar 19, 2013
@punker76
Copy link
Owner Author

fixed in version 0.1.3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant