Spacing Commands in WPF SfDiagram
18 Nov 20181 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.
NOTE
Spacing commands use the first and last objects in the current selection as reference objects. These reference objects retain their positions, and the remaining selected objects are evenly distributed between them. Therefore, the resulting spacing may vary depending on the selection order.
NOTE
At least three objects must be selected to apply spacing commands effectively. The first and last selected objects are used as reference objects, and the remaining selected objects are distributed evenly between them. If fewer than three objects are selected, the spacing command will not produce any visible change.
SpaceAcross command
The SpaceAcross command is used to place selected objects on the page at equal horizontal intervals.
<Button Height="50" Content="SpaceAcross" Name="SpaceAcross" Command="Syncfusion:DiagramCommands.SpaceAcross"></Button>//Initialize the SfDiagram
SfDiagram diagramcontrol = new SfDiagram();
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 vertical intervals.
<Button Height="50" Content="SpaceDown" Name="SpaceDown" Command="Syncfusion:DiagramCommands.SpaceDown"></Button>//Initialize the SfDiagram
SfDiagram diagramcontrol = new SfDiagram();
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;
// Equally spaces the selected nodes vertically
graphinfo.Commands.SpaceDown.Execute(null);