How to control location of pasted item?

We’ve implemented Paste functionality using NW command handler. How do I control the location of a pasted item though?

It seems like the paste command always puts the pasted node in the upper left corner of the diagram. We’d like it to show, if possible, where the mouse cursor is.

Normally the paste command will position the copied parts where they had been. Furthermore, commands are not normally affected by the mouse position. For example, if the command is invoked by a button, the mouse is usually where the button is.

The pasted parts will be the diagram’s selection collection. So you can find out where they are by calling myDiagram.Panel.ComputeBounds(myDiagram.SelectedParts).

Then you need to decide where to move them, in diagram coordinates (you may want to call Diagram.Panel.TransformViewToModel to convert a point in FrameworkElement coordinates into model coordinates).

To move the selection, you can shift the Node.Location of each selected Node.