Move from palette to diagram

Hi,

I’m new to GoXam and have to say I’m enjoying it a lot. One thing I have trouble to figure out, is how I can drag items/nodes from a palette and drop them onto a diagram. I would like to do two things: remove it from the palette and change the data.

I tried to do it manually with the Drop event. But the data remains null. I suggest that

Any suggestions?

Greetings,
Arnoud

Palettes are read-only by default, so you need to set IsReadOnly=“False”. Also you need to make the palette’s Model.IsModifiable=true, since it is unmodifiable by default too.

Now shift-dragging a node from the palette and successfully dropping it onto another Diagram should cause the node to be removed, and of course its bound data from the palette’s model.

If you don’t want to require the user to hold down the shift key when dropping, and maybe if you want to require holding down the control key to support copying instead of moving, you can override DraggingTool.DoDragDrop and fiddle with the DragDropEffects flags. (Install your custom DraggingTool by replacing myPalette.DraggingTool with a new instance either in code or in XAML.)