CanStart of DraggingTool

Hi,
I’m have 2 palettes from which I drag items into the main diagram.
In order to distinguish between them I’ve set the DataFormat of them to different strings.
On the main diagram I have a dragging tool that handle the dropping of the items.
Currently there is a single tool for both of the types of items each palette has.

I would like to write two different tools because they do very different work during dropping. The problem is I don’t have access to the dragged data during the CanStart method so I can’t tell there which type of data is dragged on the digram.

Thank you,
Ido.

First, to be clear that I understand you, are you able to easily implement the two different behaviors using either a single custom tool with an override of DraggingTool.DoDrop or DropOnto, or more simply by implementing a Diagram.ExternalObjectsDropped event handler, either of which looks at the data to decide what to do?

The problem with what you are asking is that CanStart isn’t called on any tools in the target/destination Diagram. It’s only called in the source Diagram where the drag-and-drop starts. The WPF DragEnter, DragLeave, DragOver, and Drop events get delivered directly to the target Diagram. The event handlers then find the Diagram’s DraggingTool and call the corresponding “Do…” method on it.

I suppose you could override the event-handling methods to choose which DraggingTool to call, but it seems easier to just customize a single DraggingTool by overriding its methods to decide what to do.

Hi,
Thanks for the detailed answer (yet again).
The window contain the diagram is designed to be extensible, that’s why I think I’ll go with overriding DiagramPanel.OnDrag* methods and dispatch them to internal list of drag handlers.
I’ll leave the DraggingTool to actually handle dragging of parts on the diagram itself and not handle drag-drop events.

Thank you,
Ido.