Articles in this section
Category / Section

How do I programmatically group nodes in a diagram?

1 min read

Programmatically group nodes in a diagram

You need to use the GroupCmd Class which will create a Group node and populate it with the list of nodes attached to the command. Here is a code sample that demonstrates how you can group the nodes that are selected in a Diagram.

[C#]

//New Groupcmd to group nodes GroupCmd gcmd = new GroupCmd(); //Add the selected nodes to the GroupCmd gcmd.Nodes.Concat(this.diagramComponent.SelectionList); //Execute the GroupCmd this.diagramComponent.ExecuteCommand(gcmd); diagramComponent.Refresh();

[VB.NET]

'New Groupcmd to group nodes Dim gcmd As GroupCmd =  New GroupCmd() 'Add the selected nodes to the GroupCmd gcmd.Nodes.Concat(Me.diagramComponent.SelectionList) 'Execute the GroupCmd Me.diagramComponent.ExecuteCommand(gcmd) diagramComponent.Refresh()

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied