Skip to content

Commit

Permalink
feat: add new interface to catch the dropped item
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Mar 3, 2022
1 parent ee0df5f commit bc791ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/GongSolutions.WPF.DragDrop/DefaultDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ public virtual void Drop(IDropInfo dropInfo)
{
destinationList.Insert(insertIndex++, obj2Insert);
}

if (obj2Insert is IDragItemSource dragItemSource)
{
dragItemSource.ItemDropped(dropInfo);
}
}

SelectDroppedItems(dropInfo, objects2Insert);
Expand Down
3 changes: 3 additions & 0 deletions src/GongSolutions.WPF.DragDrop/IDragItemCloneable.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace GongSolutions.Wpf.DragDrop
{
/// <summary>
/// Supports cloning like the ICloneable interface, which creates a new instance of a class with the same value as an existing instance.
/// </summary>
public interface IDragItemCloneable
{
/// <summary>
Expand Down
14 changes: 14 additions & 0 deletions src/GongSolutions.WPF.DragDrop/IDragItemSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace GongSolutions.Wpf.DragDrop
{
/// <summary>
/// Supports methods for models which can be dropped.
/// </summary>
public interface IDragItemSource
{
/// <summary>
/// Indicates that the item is dropped on the destination list.
/// </summary>
/// <param name="dropInfo"></param>
void ItemDropped(IDropInfo dropInfo);
}
}

0 comments on commit bc791ef

Please sign in to comment.