Sizing Commands in WPF SfDiagram
18 Nov 20182 minutes to read
Sizing commands are used to resize all selected objects based on width, height, or size of the reference object (FirstSelectedItem).
NOTE
Sizing commands use the
FirstSelectedItemas the reference object. The size of this object is preserved, and all other selected objects are resized to match its width, height, or overall size, depending on the command being executed. Therefore, the sizing result depends on which object is selected first.
NOTE
Sizing commands require at least two selected objects. The first selected object is used as the reference object, and the remaining selected objects are resized based on it. If only one object is selected or no objects are selected, the sizing command will not produce any change.
SameSize command
The SameSize command is used to resize all the selected objects based on the size of the first item in the selection list.
<Button Height="50" Content="SameSize" Name="SameSize" Command="Syncfusion:DiagramCommands.SameSize"></Button>//Initialize the SfDiagram
SfDiagram diagramcontrol = new SfDiagram();
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;
//Scales the selected items to the size of first selected object
graphinfo.Commands.SameSize.Execute(null);SameHeight command
The SameHeight command is used to resize all the selected objects based on the height of the first item in the selection list.
<Button Height="50" Content="SameHeight" Name="SameHeight" Command="Syncfusion:DiagramCommands.SameHeight"></Button>//Initialize the SfDiagram
SfDiagram diagramcontrol = new SfDiagram();
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;
//Vertically scales the selected items to the height of first selected object
graphinfo.Commands.SameHeight.Execute(null);SameWidth command
The SameWidth command is used to resize all the selected objects based on the width of the first item in the selection list.
<Button Height="50" Content="SameWidth" Name="SameWidth" Command="Syncfusion:DiagramCommands.SameWidth"></Button>//Initialize the SfDiagram
SfDiagram diagramcontrol = new SfDiagram();
IGraphInfo graphinfo = diagramcontrol.Info as IGraphInfo;
//Horizontally scales the selected items to the width of first selected object
graphinfo.Commands.SameWidth.Execute(null);