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.28k stars 400 forks source link

Is there an example of using IDragHandler? (need to intercept start of drag operation) #443

Open RickStrahl opened 2 years ago

RickStrahl commented 2 years ago

It looks like this control supports IDragHandler but there are no examples that show how this works. I've implemented the interface and set IsDragSource=true assigned the data source and I have the events firing but items don't start actually dragging.

My use case is that I want to handle drag operations out of the control into standard DataObject so that I can drop on another control that already handles drop targets seperately (in JavaScript in a WebView control in my case) and that is not have a dd:DropSource.

IOW:

In essence I want to take advantage of the nice drag initiation behavior of Gong, but once we're dragging utilize standard D&D behavior on the target.

Is this possible? It seems like it should be since Gong works with standard D&D objects, but I'm not sure.

Reason for not being able to use Gong on the target is that the drag operation is actually picked up in a JavaScript client inside of a WebView - this works fine with standard D&D objects/events.

Chri-s commented 1 year ago

Perhaps a bit late, but I created an example repository at Chri-s/DragHandlerSample. Have a look at CustomTextDragSource.cs and CustomFileDragSource.cs.

punker76 commented 12 months ago

@RickStrahl Did you look at the example of @Chri-s ? I think this is maybe what yo need.