Grouping Commands in WPF Diagram (SfDiagram)

5 May 20211 minute to read

The Grouping commands are used to group or ungroup the selected diagramming objects such as node and connector in the diagram.

Group command

The Group command is used to group the selected diagramming objects in the diagram page. The Group command can be executed by the keyboard shortcut CTRL + G.

<Button Height="50" Content="Cancel" Name="Cancel" Command="Syncfusion:DiagramCommands.Group"></Button>
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;

//Groups the selected elements.
graphinfo.Commands.Group.Execute(null);

UnGroup command

The UnGroup command is used to ungroup the selected group diagramming objects in the diagram page. UnGroup command can be executed by the keyboard shortcut CTRL + G.

<Button Height="50" Content="Cancel" Name="Cancel" Command="Syncfusion:DiagramCommands.UnGroup"></Button>
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;

//UnGroups the selected group elements.
graphinfo.Commands.UnGroup.Execute(null);

Group/UnGroup gif

View sample in GitHub