Copy a GroupNode


In my Wpf app I want to copy a GroupNode from a diagram to another via a buttonClick event instead of draging. I used the PartManager.CopyParts() method and it works well with a single node but fails with a GroupNode containing some sigle nodes. Not like draging with mouse, it doesn't copy anything to the new diagram. I also tried AddNode() method of the model, still not work either.

Copy and paste are normally implemented by using the Copy command and the Paste command:

<Button Command="Copy" CommandTarget="{Binding ElementName=myDiagram}">Copy</Button> <Button Command="Cut" CommandTarget="{Binding ElementName=myDiagram}">Cut</Button> <Button Command="Paste" CommandTarget="{Binding ElementName=myDiagram}">Paste</Button>

This is just in WPF, of course, which supports commands.

For those readers who are using Silverlight, Silverlight 4 will have a minimal commanding mechanism, but no RoutedCommands nor any predefined commands. But GoXam will have predefined non-routed commands that will work in both WPF and in Silverlight 4.