I have a WPF GoXam Diagram that sits inside of a legacy WinForms application. (I have a WPF UserControl that contains a GoXam Diagram; the UserControl then sits inside of an ElementHost.) There are other WinForms controls within my app that are valid drop targets so I should be able to drag from my diagram and drop the result onto those controls. The drop behavior is defined differently by each control, but a common format is used within the WinForms DataObject. I see two challenges and could use a little guidance:
- Where and when do I create the necessary System.Windows.Forms.DataObject when dragging out of the diagram? (The DataObject will contain a list of the node keys that are participating in the drag.)
- How do I retain the built-in GoXam functionality when I’m dragging within the diagram?
I’ve played around with the DraggingTool and it’s not making much sense to me. I overrode DoDragEnter and DoDragLeave (with a simple Debug.WriteLine and then calling the base method) and am seeing far more calls than I expect. For example, dragging a node around in circles with the mouse generates a number of Enter/Leave calls despite the fact that my mouse cursor never leaves or even comes close to the bounds of the GoXam diagram.
I would have expected the leave override to be called only when leaving the Diagram and the enter override only when entering the diagram.
Or am I over thinking this whole thing and it’s as simple as overriding DraggingTool.DoDragDrop to call DragDrop.DoDragDrop with my list of node keys? (But it seems like this would cause the built in functionality to break when dragging within a GoXam digram.) Any pointers you can give me would be appreciated.