How to copy/paste between different layers

I would like to select a node on layer A . Then I switch to aother layer B by mark B as visible and A as invisible. Then do a paste through “ctrl + v” to invoke build-in paste behavior on layer B. However, the paste still happens on layer A where the old node is on. I tried to listen to “ClipboardPasted” event after paste happens, then I do a manually add node in layer B and delete the new copied node on layer A which was added by default paste behavior. But I wonder this might not be the right way. Any guidance?

Thanks,
Chuan

That’s the right idea – implement a “ClipboardPasted” DiagramEvent listener that iterates through the selection and changes the layer of each.

If you have a Binding on Part.layerName, you can set the property on the data via Model.setDataProperty. Or you can set Part.layerName directly.

Thanks, that works.