Skip to content

Commit

Permalink
Merge pull request #125 from gerritvanroekel/master
Browse files Browse the repository at this point in the history
Fix an issue when the itempresenter contains more ContentControls
  • Loading branch information
punker76 committed Mar 26, 2015
2 parents a850796 + ee1d97e commit 9e85a9e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion GongSolutions.Wpf.DragDrop/Utilities/VisualTreeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public static DependencyObject GetVisualAncestor(this DependencyObject d, Type t
if (item == itemsControl) {
return lastFoundItemByType;
}
if (item.GetType() == type || item.GetType().IsSubclassOf(type)) {
if ((item.GetType() == type || item.GetType().IsSubclassOf(type))
&& (itemsControl == null || itemsControl.ItemContainerGenerator.IndexFromContainer(item) >= 0)) {
lastFoundItemByType = item;
}
item = VisualTreeHelper.GetParent(item);
Expand Down

0 comments on commit 9e85a9e

Please sign in to comment.