Spacing Commands in WPF Diagram (SfDiagram)
29 Nov 20241 minute to read
Spacing commands are used to place selected objects on the page at equal intervals from each other. The objects are spaced within the bounds of the first and last objects in the selection.
SpaceAcross command
The SpaceAcross
command is used to place selected objects on the page at equal intervals from each other horizontally.
<Button Height="50" Content="SpaceAcross" Name="SpaceAcross" Command="Syncfusion:DiagramCommands.SpaceAcross"></Button>
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;
// Equally spaces the selected nodes horizontally
graphinfo.Commands.SpaceAcross.Execute(null);
SpaceDown command
The SpaceDown
command is used to place selected objects on the page at equal intervals from each other vertically.
<Button Height="50" Content="SpaceDown" Name="SpaceDown" Command="Syncfusion:DiagramCommands.SpaceDown"></Button>
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;
// Equally spaces the selected nodes vertically
graphinfo.Commands.SpaceDown.Execute(null);