Difference in copy

Hi Walter,
I have a strange behavior in my diagram.
If I select a node and press ctrl-c and ctrl-v a new node is created. This node is complete different from the original node. That means in my node-class there are two collections (I explained you some time ago: a collection of displays and a collection of functions) and in the copied node these collections are new instances too (which is exact what I want).

Now, if I hold the ctrl-key and move a node, the diagram creates a copy of this node - but this time the collections of the two nodes are the same. That means if I change the color of a display in the first node, the second node also changes it’s color (that is not what I want).

Where is the difference between the two copy behaviors and how can I fix that?

Does your data implement ICloneable, and if so, does it properly make a deep copy of the data, rather than a shallow copy?

Or you can override GraphLinksModel.CopyNode1 to do that.

Or does it inherit from GraphLinksModelNodeData? If so, you can override its Clone method.

No it doesn’t!
But why there is the difference?

Does your data implement ISerializable? That’s doing a copy for you automatically, to and from the clipboard. There’s no clipboard involved when using the DraggingTool.

Yes, the data implements ISerializable!
That’s the reason than.
I’ll give it a try.