Skip to content

Commit

Permalink
Merge pull request #99 from claudekennilol/master
Browse files Browse the repository at this point in the history
Updated HighlightAdorner to highlight the entire expanded item.
  • Loading branch information
punker76 committed May 16, 2014
2 parents 5b6368e + 4de36d7 commit 5a67d8a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions GongSolutions.Wpf.DragDrop/DropTargetHighlightAdorner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ protected override void OnRender(DrawingContext drawingContext)

var tvItem = visualTargetItem as TreeViewItem;
if (tvItem != null && VisualTreeHelper.GetChildrenCount(tvItem) > 0) {
var grid = VisualTreeHelper.GetChild(tvItem, 0) as Grid;
if (grid != null) {
var descendant = VisualTreeHelper.GetDescendantBounds(tvItem);
rect = new Rect(tvItem.TranslatePoint(new Point(), this.AdornedElement), new Size(descendant.Width + 4, grid.RowDefinitions[0].ActualHeight));
}
var descendant = VisualTreeHelper.GetDescendantBounds(tvItem);
rect = new Rect(tvItem.TranslatePoint(new Point(), this.AdornedElement), new Size(descendant.Width + 4, tvItem.ActualHeight));
}
if (rect.IsEmpty) {
rect = new Rect(visualTargetItem.TranslatePoint(new Point(), this.AdornedElement), VisualTreeHelper.GetDescendantBounds(visualTargetItem).Size);
Expand All @@ -32,4 +29,4 @@ protected override void OnRender(DrawingContext drawingContext)
}
}
}
}
}

0 comments on commit 5a67d8a

Please sign in to comment.