Try overriding the model’s MakeNodeKeyUnique method.
You can use the FindNodeByKey method to see if a particular key already has a data object associated with it.
I was tried the option, but makeNodeKeyUnique doesn’t invoke with the drop of the first element of the palette, but it is launched with de second… of the same type of the palette. If i drop two different elements, this method doen’t execute.
But now i was overrided the OneNodeAdded, but it excute two times, one when drag the element and other when drop, and so when DragSelectingBox is invoked with the mouse.
It might be cleaner to implement a Model.Changed event handler to detect and event with ModelChangedEventArgs.Change == ModelChange.AddedNode.
In this event hander you can see if !(Diagram.CurrentTool is DraggingTool), or if DraggingTool.Source != null. If that’s the case you know it’s a drag from another control.