punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
BSD 3-Clause "New" or "Revised" License
2.25k stars 392 forks source link

[New Feature] Drop target hints #487

Open bsundsbo opened 4 months ago

bsundsbo commented 4 months ago

I'm looking for a new feature with Hints for drop targets that can accept data of a particular type, and give the user information about what will happen when something is dropped (we've discussed this by email in the past). We've had this functionality in our apps for over a decade, and want this functionality as part of the gong-wpf-dragdrop project.

The functionality is similar to dragging a file to the text field of the message input part in Teams, "drop file her" to upload in dropbox or other websites.

Here is a sample I added to a fork years ago, though some improvements could obviously be made.

DropHints

bsundsbo commented 4 months ago

I've started working on a new PR for this where I write from scratch, and not directly reusing the code from the example above. However, there were some limitations to time and availability of being able to construct DropInfo at the time.

I will be making some adjustments to the screenshot above though, with DestinationText and datatemplate for how to display this text to the user.

In my PR I am making an interface IDropTargetHint which I might derive from IDropTarget, and implement in the DefaultDropHandler so everything works out of the box assuming the default handler is used, however, I am running into a question about what to pass to that method.

What I am initially wanting my IDropTargetHint.DropHint to do is:

The issue that I am trying to figure out, is I should extend IDropInfo with DropTargetHintAdnorner for the user to assign, and then go from there, or should there be a IDropHintInfo with limited parameters? Using DropInfo gives the flexibility of being able to reuse the DefaultDropHandler.CanAcceptData and reusing other methods and classes (but DragEventArgs won't be available), but it also gives the potential of a lot of properties that are not needed.

What are your recommendations?

mangoyoga80 commented 4 months ago

Addressed in PR https://github.com/punker76/gong-wpf-dragdrop/pull/489