Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions GongSolutions.Wpf.DragDrop/DropInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ public DropInfo(object sender, DragEventArgs e, DragInfo dragInfo)

if (item != null) {
itemParent = ItemsControl.ItemsControlFromItemContainer(item);

this.TargetIndex = itemParent.ItemContainerGenerator.IndexFromContainer(item);

this.InsertIndex = itemParent.ItemContainerGenerator.IndexFromContainer(item);
this.InsertIndex = this.TargetIndex;
this.TargetCollection = itemParent.ItemsSource ?? itemParent.Items;

var tvItem = item as TreeViewItem;
Expand Down Expand Up @@ -215,7 +217,12 @@ public DropInfo(object sender, DragEventArgs e, DragInfo dragInfo)
/// Gets the current insert position within <see cref="TargetCollection"/>.
/// </summary>
public int InsertIndex { get; private set; }


/// <summary>
/// Gets the index of the target item within <see cref="TargetCollection"/>.
/// </summary>
public int TargetIndex { get; private set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this? It's the same as InsertIndex.


/// <summary>
/// Gets the current insert position within the source (unfiltered) <see cref="TargetCollection"/>.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions GongSolutions.Wpf.DragDrop/IDropInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public interface IDropInfo
/// </summary>
int InsertIndex { get; }

/// <summary>
/// Gets the index of the target item within <see cref="TargetCollection"/>.
/// </summary>
int TargetIndex { get; }

/// <summary>
/// Gets the current insert position within the source (unfiltered) <see cref="TargetCollection"/>.
/// </summary>
Expand Down