Adding BringIntoCenter to an Application
DiagramView diagramView=new DiagramView();
//Call the BringIntoCenter method to bring the “node” object into the center of the viewport.
diagramView.BringIntoCenter(node);
Dim diagramView As New DiagramView()
'Call the BringIntoCenter method to bring the “node” object into the center of the viewport.
diagramView.BringIntoCenter(node)
The BringIntoCenter method of the DiagramView class is used to bring the object into the center of the viewport. This method will accept only parameters of type Node, LineConnector, or Rect.
Snap to Grid
The Snap to Grid feature enables dragging nodes and connectors in multiples of offset values, which is specified by using DiagramView’s SnapOffsetX and SnapOffsetY properties. For example, if a node is dragged when SnapOffsetX is set to 25, then the nodes OffsetX value will change in multiples of 25.
Use Case Scenarios
Users can snap objects with respect to grid lines in the Design environment by using Snap to Grid instead of smooth dragging.
Node Before Snapping
Node After Snapping
Enabling Snap to Grid
The Snap to Grid feature for nodes and connectors can be enabled by setting DiagramView’s SnapToHorizontalGrid and SnapToVerticalGrid properties to ”True”, as shown in the following code snippets.
In the following code snippets, diagramView is an instance of DiagramView.
<syncfusion:DiagramView x:Name="diagramView" SnapToHorizontalGrid="True" SnapToVerticalGrid="True" >
</syncfusion:DiagramView>
// Enable snap to vertical grid.
diagramView.SnapToVerticalGrid = true;
// Enable snap to horizontal grid.
diagramView.SnapToHorizontalGrid = true;
'Enable snap to vertical grid.
diagramView.SnapToVerticalGrid = True
'Enable snap to horizontal grid.
diagramView.SnapToHorizontalGrid = True
Snap to Grid Enabled
Customizing Snap to Grid Offset Values
By default, the SnapOffsetX and SnapOffsetY values are set to 25 pixels. However, these values can be changed so that objects will snap to the horizontal grid by using SnapOffsetX and snap to the vertical grid by using SnapOffsetY, as shown in the following code snippets.
In the following code snippets, diagramView is an instance of DiagramView.
<syncfusion:DiagramView x:Name="diagramView" SnapOffsetX ="50" SnapOffsetY ="50">
</syncfusion:DiagramView>
diagramView.SnapOffsetX = 50;
diagramView.SnapOffsetY = 50;
diagramView.SnapOffsetX = 50
diagramView.SnapOffsetY = 50
NOTE
SnapToGrid will snap objects based on the offset values specified in DiagramView’s SnapOffsetX and SnapOffsetY values and it works independently from grid lines. However, to snap objects along with the grid lines, specify the same offset values for grid lines and snap offset.
Also, snapping of objects will occur only when the objects are dragged during runtime. Even after snapping is enabled, users can specify their own offset values in code behind.
Properties
The properties of the Snap to Grid feature are described in the following tabulation:
Property | Description | Type | Data Type | Reference links |
---|---|---|---|---|
SnapOffsetX | Snaps to the horizontal offset value. | Dependency property | double | Not applicable |
SnapOffsetY | Snaps to the vertical offset value. | Dependency property | double | Not applicable |
SnapToHorizontalGrid | Enables or disables snap to horizontal grid. | Dependency property | bool, true/false | Not applicable |
SnapToVerticalGrid | Enables or disables snap to vertical grid. | Dependency property | bool, true/false | Not applicable |
Sample Link
To view a sample:
- Open the Diagram Sample Browser from the dashboard. (Refer to the Samples and Location chapter.)
- Navigate to Editable Diagram -> SnapToGrid Demo.
Measurement Units
Different fields require different units of measure, and therefore several measurement units are provided such that you can choose the unit that is most comfortable and suitable to use. All basic properties can be defined in the specified measurement unit. It is also possible to dynamically change the units at run-time. The rulers are updated accordingly to represent the coordinates in the currently selected unit.
Use Case Scenarios
Measurement units will be usefull when the user wants to access objects in any of the available units.
Units changed to Inches
Specification of Units
The measurement units property can be specified in the following ways:
<sfdiagram:DiagramControl IsSymbolPaletteEnabled="True" >
<sfdiagram:DiagramControl.Model>
<sfdiagram:DiagramModel x:Name="diagramModel" >
</sfdiagram:DiagramModel>
</sfdiagram:DiagramControl.Model>
<sfdiagram:DiagramControl.View >
<sfdiagram:DiagramView ShowHorizontalGridLine="True" ShowVerticalGridLine="True">
<syncfusion:DiagramView.Page>
<syncfusion:DiagramPage x:Name="diagramPage" MeasurementUnits="Inch"/>
</syncfusion:DiagramView.Page>
</sfdiagram:DiagramView>
</sfdiagram:DiagramControl.View>
</sfdiagram:DiagramControl>
DiagramControl dc = new DiagramControl();
dc.IsSymbolPaletteEnabled = true;
DiagramView view = new DiagramView();
(view.Page as DiagramPage).MeasurementUnits = MeasureUnits.Inch;
Dim dc As New DiagramControl()
dc.IsSymbolPaletteEnabled = True
Dim view As New DiagramView()
TryCast(view.Page, DiagramPage).MeasurementUnits = MeasureUnits.Inch
Once the measurement unit is specified, all the values must be specified with respect to that unit. Forexample, if the unit is set to Inch, then the node’s properties can be set as follows:
Node n1 = new Node(Guid.NewGuid(), "Node1");
n1.IsLabelEditable = true;
n1.Label = "Alarm Rings";
n1.OffsetX = 1.5;
n1.OffsetY = 1.25;
n1.Width = 1.5;
n1.Height = 0.75;
n1.LabelVerticalAlignment = VerticalAlignment.Center;
diagramModel.Nodes.Add(n1);
Dim n1 As New Node(Guid.NewGuid(), "Node1")
n1.IsLabelEditable = True
n1.Label = "Alarm Rings"
n1.OffsetX = 1.5
n1.OffsetY = 1.25
n1.Width = 1.5
n1.Height = 0.75
n1.LabelVerticalAlignment = VerticalAlignment.Center
diagramModel.Nodes.Add(n1)
You can also dynamically change the units at runtime. The ruler values get changed according to the measurement unit selected. The rulers then indicate the position of the graphical objects with respect to the selected measurement unit.
Units changed to Inches
Tables for Properties, Methods, and Events
Properties
Property | Description | Type | Data Type | Reference links |
---|---|---|---|---|
MeasurementUnits | Gets or sets the measurement unit property. | DependencyProperty |
MeasureUnits.Pixel
MeasureUnits.Point MeasureUnits.Document MeasureUnits.Display MeasureUnits.SixteenthInch MeasureUnits.EighthInch MeasureUnits.QuarterInch MeasureUnits.HalfInch MeasureUnits.Inch MeasureUnits.Foot MeasureUnits.Yard MeasureUnits.Mile MeasureUnits.Millimeter MeasureUnits.Centimeter MeasureUnits.Meter MeasureUnits.Kilometer |
no |
Sample Link
The sample for Measurement Units is hosted in the following location:
[sample installation location]\Syncfusion\EssentialStudio\Version Number\ \Silverlight\Syncfusion.Diagram.Silverlight.Samples\Samples\General Features\RulerDemo.xaml
Clipboard Commands
Clipboard commands are used to perform cut, copy and paste operations.
Property | Description | Type | Data Type | Reference link |
---|---|---|---|---|
IsCutEnabled | Gets or sets a value indicating whether cut command is enabled. Default value is True. | Dependency property | Boolean | NA |
IsCopyEnabled | Gets or sets a value indicating whether copy command is enable. Default value is True. | Dependency property | Boolean | NA |
IsPasteEnabled | Gets or sets a value indicating whether paste command is enable. Default value is True. | Dependency property | Boolean | NA |
Clipboard commands enable you to cut or copy the selected objects from the page to the clipboard and paste the valid clipboard content to the page. This can be done in two methods:
- Using Clipboard Commands
- Using Shortcut Keys
Using Clipboard Commands
Cut Command
Following code illustrates how to cut the selected objects from the page to the Clipboard:
<Button Content="Cut" Command="{Binding Cut, ElementName=diagramControl}"/>
diagramControl.Cut.Execute(diagramControl.View);
diagramControl.Cut.Execute(diagramControl.View)
Copy Command
Following code illustrates how to copies the selected objects from the page into the Clipboard:
<Button Content="Copy" Command="{Binding Copy, ElementName=diagramControl}"/>
diagramControl.Copy.Execute(diagramControl.View);
diagramControl.Copy.Execute(diagramControl.View)
Paste Command
Following code illustrates how to paste the contents of the valid clipboard into the page:
<Button Content="Paste" Command="{Binding Paste, ElementName=diagramControl}"/>
diagramControl.Paste.Execute(diagramControl.View);
diagramControl.Paste.Execute(diagramControl.View)
Using Shortcut Keys
Following are the shortcut keys for clipboard command:
- Cut – Ctrl + X
- Copy – Ctrl + C
- Paste – Ctrl + V
Disable Clipboard Commands
Clipboard command can be disabled. The following code illustrates how to disable them:
<!--Diagram Control-->
<syncfusion:DiagramControl Name="diagramControl">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel">
</syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<!-- Disable Cut, Copy and Past -->
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView IsCutEnabled="False" IsCopyEnabled="False" IsPasteEnabled="False" Name="diagramView">
</syncfusion:DiagramView>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
diagramView.IsCutEnabled = false;
diagramView.IsCopyEnabled = false;
diagramView.IsPasteEnabled = false;
diagramView.IsCutEnabled = False
diagramView.IsCopyEnabled = False
diagramView.IsPasteEnabled = False
NOTE
Dialog box will open to confirm access to Clipboard. Click Yes to access clipboard as long as application is running. Click No to deny access. You can also save your answer.
Nudge Commands
Nudge commands allow you to move the selected objects on the page by one pixel.
Nudge Operation
Nudge operation can be performed in two ways namely:
-
Using Nudge Commands
-
Using Arrow Keys
NudgeUp
NudgeUp moves the selected object to the top by one pixel. This command can be executed in XAML and code behind. In the following code snippet diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the MoveUp command.
<Button Content="MoveUp" Command="{Binding MoveUp, ElementName=diagramControl}"/>
diagramControl.NudgeUp.Execute(diagramControl.View);
diagramControl.NudgeUp.Execute(diagramControl.View)
NudgeDown
Moves the selected object to the bottom by one pixel. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the MoveDown command.
<Button Content="MoveDown" Command="{Binding MoveDown, ElementName=diagramControl}"/>
diagramControl.NudgeDown.Execute(diagramControl.View);
diagramControl.NudgeDown.Execute(diagramControl.View)
NudgeLeft
NudgeLeft Moves the selected object to the left by one pixel. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the MoveLeft command.
<Button Content="MoveLeft" Command="{Binding MoveLeft, ElementName=diagramControl}"/>
diagramControl.NudgeLeft.Execute(diagramControl.View);
diagramControl.NudgeLeft.Execute(diagramControl.View)
NudgeRight
Moves the selected object to the right by one pixel. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the MoveRight command.
<Button Content="MoveRight" Command="{Binding MoveRight, ElementName=diagramControl}"/>
diagramControl.NudgeRight.Execute(diagramControl.View);
diagramControl.NudgeRight.Execute(diagramControl.View)
Nudge by using Arrow Keys
The corresponding arrow keys can be used to move the selected objects to the top, bottom, left or right.
Nudge by using Arrow Keys
Nudge commands are very useful for accurate placement of objects on pages as they allow you to move by one pixel each time.
Sample Link
To view the samples:
Open the Diagram Sample Browser from the dashboard. (Refer to Samples and Location chapter).
Navigate to Product Showcase -> Feature Demo.
Z-order Commands
The ordering commands allow you to change the z-order (order of objects along the Z-axis) value (of the selected objects (nodes and connectors) on the page. The objects can be made to go back or front so that they get displayed over other objects in case two or more objects overlap.
Z-Order Operation
There are four Z-Order commands, namely:
-
BringToFront
-
SendToBack
-
MoveForward
-
SendBackward
BringToFront
Moves the selected object over other objects by increasing the z-order value to a maximum. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the BringToFront command.
<Button Content="BringToFront" Command="{Binding BringToFront, ElementName=diagramControl}"/>
diagramControl.BringToFront.Execute(diagramControl.View);
diagramControl.BringToFront.Execute(diagramControl.View)
Bring To Front
SendToBack
SendToBack moves the selected object behind all other objects by setting the z-order value to 0. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the SendToBack command.
<Button Content="SendToBack" Command="{Binding SendToBack, ElementName=diagramControl}"/>
diagramControl.SendToBack.Execute(diagramControl.View);
diagramControl.SendToBack.Execute(diagramControl.View)
Send To Back
MoveForward
MoveForwrd increases the z-order value of the selected object by one. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the MoveForward command.
<Button Content="BringForward" Command="{Binding BringForward, ElementName=diagramControl}"/>
diagramControl.MoveForward.Execute(diagramControl.View);
diagramControl.MoveForward.Execute(diagramControl.View)
Move Forward
SendBackward
SendBackward decreases the z-order value of the selected object by one. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the SendBackward command.
<Button Content="SendBackward" Command="{Binding SendBackward, ElementName=diagramControl}"/>
diagramControl.SendBackward.Execute(diagramControl.View);
diagramControl.SendBackward.Execute(diagramControl.View)
Send Backward
Sample Link
To view the samples:
Open the Diagram Sample Browser from the dashboard. (Refer to Samples and Location chapter).
Navigate to Product Showcase -> Feature Demo.
Alignment Commands
Alignment commands enable you to align selected objects (nodes and connectors) on a page with respect to a reference object. The first object in the selection is considered as the reference object.
Perform Alignment Operation
The following alignment commands are used to align objects:
Left Alignment
The AlignLeft command aligns all selected objects along the left corner of the reference object. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the AlignLeft command.
<Button Content="AlignLeft" Command="{Binding AlignLeft, ElementName=diagramControl}"/>
diagramControl.AlignLeft.Execute(diagramControl.View);
diagramControl.AlignLeft.Execute(diagramControl.View)
The following screen shot illustrates the allignment of the last two nodes to the left with respect to the first node.
AlignLeft command applied to Diagram Objects
Center Alignment (Horizontal Axis)
The AlignCenter command aligns all the selected objects to the center. This command center-aligns selected objects with respect to the horizontal axis, i.e., by changing the x-coordinate of the object. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the AlignCenter command.
<Button Content="AlignCenter" Command="{Binding AlignCenter, ElementName=diagramControl}"/>
diagramControl.AlignCenter.Execute(diagramControl.View);
diagramControl.AlignCenter.Execute(diagramControl.View)
The following screen shot illustrates the allignment of the last two nodes to the center with respect to the horizontal axis of the first node.
AlignCenter command applied to Diagram Objects
Right Alignment
The AlignRight command aligns all selected objects along the right corner of the reference object. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the AlignRight command.
<Button Content="AlignRight" Command="{Binding AlignRight, ElementName=diagramControl}"/>
diagramControl.AlignRight.Execute(diagramControl.View);
diagramControl.AlignRight.Execute(diagramControl.View)
The following screen shot illustrates the allignment of the last two nodes to the right with respect to the first node.
AlignRight command applied to Diagram Objects
Top Alignment
The AlignTop command aligns all the selected objects on the top of the reference object. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the AlignTop command.
<Button Content="AlignTop" Command="{Binding AlignTop, ElementName= diagramControl}"/>
diagramControl.AlignTop.Execute(diagramView.Page, diagramView);
diagramControl.AlignTop.Execute(diagramView.Page, diagramView)
The following screen shot illustrates the allignment of the last two nodes to the top with respect to the first node.
AlignTop command applied to Diagram Objects
Center Alignment (Vertical Axis)
The AlignMiddle command aligns all the selected objects at the center. This command center-aligns selected objects with respect to the vertical axis, i.e., by changing the y-coordinate of the object. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the AlignMiddle command.
<Button Content="AlignMiddle" Command="{Binding AlignMiddle, ElementName= diagramControl}"/>
diagramControl.AlignMiddle.Execute(diagramControl.View);
diagramControl.AlignMiddle.Execute(diagramControl.View)
The following screen shot illustrates the allignment of the last two nodes to the center with respect to the vertical axis of the first node.
AlignMiddle command applied to Diagram Objects
Bottom Alignment
The AlignBottom command aligns all the selected objects along the bottom of the reference object. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the AlignBottom command.
<Button Content="AlignBottom" Command="{Binding AlignBottom, ElementName= diagramControl}"/>
diagramControl.AlignBottom.Execute(diagramControl.View);
diagramControl.AlignBottom.Execute(diagramControl.View)
The following screen shot illustrates the allignment of the last two nodes to the bottom with respect to the first node.
AlignBottom command applied to Diagram Objects
NOTE
The connector gets aligned only when the head node and the tail node of the connector is null.
Alignment commands are useful for ordering the layout of the objects on a page and provides a professional appearance to the diagram.
Sample Link
To view the samples:
Open the Diagram Sample Browser from the dashboard. (Refer to Samples and Location chapter).
Navigate to Product Showcase -> Feature Demo.
Spacing Commands
Spacing commands enable you to place selected objects (nodes and connectors) on the page at equal intervals from each other. The objects are spaced within the boundaries of the first and last objects in the selection object.
Spacing Operation
The following spacing commands are used to space objects:
Horizontal Spacing
The SpaceAcross command spaces selected objects with equal horizontal distance between them. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the SpaceAcross command.
<Button Content="SpaceAcross" Command="{Binding SpaceAcross, ElementName= diagramControl}"/>
diagramControl.SpaceAcross.Execute(diagramControl.View);
diagramControl.SpaceAcross.Execute(diagramControl.View)
The following screen shot illustrates horizontally spaced objects:
SpaceAcross command applied to Diagram Objects
Vertical Spacing
The SpaceDown command spaces selected objects with equal vertical distance between them. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAMl code snippet shows a button bound to the AlignDown command.
<Button Content="AlignDown" Command="{Binding AlignDown, ElementName= diagramControl}"/>
diagramControl.SpaceDown.Execute(diagramControl.View);
diagramControl.SpaceDown.Execute(diagramControl.View)
The following screen shot illustrates vertically spaced objects:
SpaceDown command applied to Diagram Objects
NOTE
The connector gets spaced only when the head node and the tail node of the connector is null.
Sample Link
To view the samples:
Open the Diagram Sample Browser from the dashboard. (Refer to Samples and Location chapter).
Navigate to Product Showcase -> Feature Demo.
Sizing Commands
Sizing commands enable you to resize selected objects (nodes and connectors) on the page. The selected objects get resized with respect to the first object in the selection list.
Sizing Operation
The following sizing commands are used to resize objects.
Height Customization
The SameHeight command resizes selected objects to the height of the first object in the selection list. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the Xaml code snippet shows a button bound to the SameHeight command.
<Button Content="SameHeight" Command="{Binding SameHeight, ElementName=diagramControl}"/>
diagramControl.SameHeight.Execute(diagramControl.View);
diagramControl.SameHeight.Execute(diagramControl.View)
SameHeight command applied to Diagram Objects
NOTE
The width of the selected object remains the same.
Width Customization
The SameWidth command resizes selected objects to the width of the first object in the selection list. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the SameWidth command.
<Button Content="SameWidth" Command="{Binding SameWidth, ElementName= diagramControl}"/>
diagramControl.SameWidth.Execute(diagramContro.View);
diagramControl.SameWidth.Execute(diagramContro.View)
SameWidth command applied to Diagram Objects
NOTE
The height of the selected object remains the same.
Height and Width Customization
The SameSize command resizes selected objects to the height and width of the first object in the selection list. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the SameSize command.
<Button Content="SameSize" Command="{Binding SameSize, ElementName= diagramControl}"/>
diagramControl.SameSize.Execute(diagramControl.View);
diagramControl.SameSize.Execute(diagramControl.View)
SameSize command applied to Diagram Objects
NOTE
The connector gets spaced only when the head node and the tail node of the connector is null.
Sample Link
To view the samples:
Open the Diagram Sample Browser from the dashboard. (Refer to Samples and Location chapter).
Navigate to Product Showcase -> Feature Demo.
Undo and Redo Commands
TheUndo command reverses the last action performed. For example, some of the basic operations such as translation, rotation, resizing, grouping, ungrouping, changing z-order, addition, deletionand so on , that are performed on diagram objects (Nodes and Line Connectors) can be reversed. The Redo command undoes the last Undo action. Alternatively, these commands can be executed using the keyboard shortcuts; Ctrl +Z for Undo command and Ctrl+Y for Redo command.
Enabling Undo and Redo Operations
The Undo command can be specified in the following way. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the Undo command.
<Button Content="Undo" Command="{Binding Undo, ElementName= diagramControl}"/>
diagramControl.Undo.Execute(diagramControl.View);
diagramControl.Undo.Execute(diagramControl.View)
The Redo command can be specified in the following way. This command can be executed in XAML and code behind. In the following code snippet, diagramControl is an instance of DiagramControl, and the XAML code snippet shows a button bound to the Redo command.
<Button Content="Redo" Command="{Binding Redo, ElementName= diagramControl}"/>
diagramControl.Redo.Execute(diagramControl.View);
diagramControl.Redo.Execute(diagramControl.View)
Disablling Undo and Redo
Disabling Undo and Redo is helpful when the Diagram control has a large number of nodes and line connectors where insertion and deletion are very frequently used. This property can be disabled so that all the references are removed for the stack. This implies that the deleted nodes will lose their references.
The following code snippet explains the disabling of the Undo Redo operation.
<sfdiagram:DiagramControl IsSymbolPaletteEnabled="True" >
<sfdiagram:DiagramControl.Model>
<sfdiagram:DiagramModel x:Name="diagramModel" >
</sfdiagram:DiagramModel>
</sfdiagram:DiagramControl.Model>
<sfdiagram:DiagramControl.View >
<sfdiagram:DiagramView UndoRedoEnabled="False"
ShowHorizontalGridLine="True" ShowVerticalGridLine="True">
</sfdiagram:DiagramView>
</sfdiagram:DiagramControl.View>
</sfdiagram:DiagramControl>
DiagramView diagramView = new DiagramView();
diagramView.UndoRedoEnabled = false;
Dim diagramView As New DiagramView()
diagramView.UndoRedoEnabled = False
Clearing Undo Redo Stack
The following code snippet illustrates the clearing of Undo Redo stack.
DiagramView diagramView = new DiagramView();
diagramView.ClearUndoRedoStack();
Dim diagramView As New DiagramView()
diagramView.ClearUndoRedoStack()
Tables for Properties, Methods, and Events
Properties
Property | Description | Type | Data Type | Reference links |
---|---|---|---|---|
UndoRedoEnabled | Gets or sets a value indicating whether undo redo is enabled or not. | Dependency property | Boolean (True/False) | No |
Methods
Method | Description | Parameters | Type | Return Type | Reference links |
---|---|---|---|---|---|
ClearUndoRedoStack | Clears the Undo and Redo stack. | Not Applicable | Not Applicable | Void | No |
Sample Link
To view the samples:
Open the Diagram Sample Browser from the dashboard. (Refer to Samples and Location chapter).
Navigate to Product Showcase -> Feature Demo.
Printing Support for Diagram Page
Features
This feature allows you to print a copy of the diagram page, using a print dialog box. The Print feature comes with two functionalities:
1.Print Dialog
The Print Dialog box is used to print the diagram page.
2.Print Preview
Print Preview is used to see how the page looks before taking a print out. The following are the options to customize the preview.
- Stretch support
- Page size
- Margins
Use Case Scenarios
You can see the output of the document before print the document, or diagram that you intend to print, using the print preview. This way, you will not have to take actual prints to see how it turns out.
Tables for Properties and Methods
Properties
Property | Description | Type | Value It Accepts | Default Values | Any other dependencies/ sub properties associated |
---|---|---|---|---|---|
DiagramPrintDialog | Gets or sets the width and height, margins and stretch of the page. | CLR property. | DiagramPrintDialog | DiagramPrintDialog | No |
DocumentName | Gets or sets the name of the printing document. | Dependency Property | string | string.Empty | No |
CurrentPage | Gets or sets which page is current page. | Dependency Property | int | 1 | No |
PageCount | Gets the no. of pages to be printed. | Dependency Property | int | 1 | No |
PageHeight | Gets or sets the page height. | Dependency Property | double | 1169 | No |
PageWidth | Gets or sets the page width. | Dependency Property | double | 827 | No |
PageMargin | Gets or sets the page margin(L,T,R,B) for printing page. | Dependency Property | Thickness(left, top, right, bottom) | Left - 50, Top - 50, Right - 50, Bottom - 50 | No |
PageStretch | Gets or sets the page stretch for printing document. | Dependency Property |
Stretch.Fill Stretch.None Stretch.Uniform Stretch.UniformTo Fill |
Stretch.Fill | No |
Methods
Method | Description | Parameters | Return Type | Reference links |
---|---|---|---|---|
PrintDialog | Print the diagram page using framework print dialog, without print preview. | null | void | No |
PrintPreview | This method is used to show the preview of the diagram to be printed. | null | void | No |
Sample Link
To view the sample for this feature, follow the steps given below:
- Open the Silverlight Sample Browser from the Dashboard.
- Navigate to Diagram -> Static Diagram ->Print Demo
Adding Printing support for Diagram Page to an Application
PrintPreview
When you call the DiagramView’s PrintPreview method, you will see the Print Preview for the diagram in a child window.
The method is in the Diagram View and can be used through Code behind:
DiagramView diagramView = new DiagramView();
diagramView.PrintPreview();
Dim diagramView As New DiagramView()
diagramView.PrintPreview()
PrintPreview Customizations
You can customise the preview of the diagram using the following options:
- Page Stretch
- Page Size
- Page Margins
Page Stretch:
The Stretch property controls how a diagram is stretched to fill the page it’s on. It accepts the following values:
- None
- Fill
- Uniform
- UniformToFill
The default value is Fill.
The following images show the various output from the example and demonstrates the effect different Stretch settings have when applied to a diagram.
Different stretch settings:
- None: The diagram will not be stretched to fill the page area. If the diagram is larger than the page area, the diagram will be split into multiple pages. An option for navigation is provided in the print preview window to view one of the multiple pages.
PrintStretch = None in PrintPreview
- Fill: The diagram is scaled to fit the output area. Because the diagram’s height and width are scaled independently, the original aspect ratio of the diagram is not preserved. This means the diagram might be warped, if necessary, in order to completely fill the page area.
PrintStretch = Fill in PrintPreview
- Uniform: The diagram is scaled, while preserving its aspect ratio, so that it fits completely within the output area.
PrintStretch = Uniform in PrintPreview
- UniformToFill: The diagram is scaled so that it completely fills the page area while preserving the diagram’s original aspect ratio.
PrintStretch = UniformToFill in PrintPreview
Page Size:
The Page size property shows how a diagram is resized. It uses the following values:
- PageHeight : To change or resize the height of the page. Its default value is 1169.
- PageWidth : You change or resize the width of the pageusing this value The default value is 827.
Page Margins:
The Page margin property is used to set the margin of the page. The Page margin property accepts the four values. That is Left, Top, Right, and Bottom.
The default is (50,50,50,50).
These properties are in DiagramPrinDialog in DiagramView and can be used through Code behind.
DiagramView diagramView = new DiagramView();
diagramView.DiagramPrintDialog.DocumentName = "Silverlight";
diagramView.DiagramPrintDialog.PageHeight = 1000;
diagramView.DiagramPrintDialog.PageWidth = 800;
diagramView.DiagramPrintDialog.PageMargin = new Thickness(20,20,20,20);
diagramView.DiagramPrintDialog.PageStretch = Stretch.None;
diagramView.PrintPreview();
Dim diagramView As New DiagramView()
diagramView.DiagramPrintDialog.DocumentName = "Silverlight"
diagramView.DiagramPrintDialog.PageHeight = 1000
diagramView.DiagramPrintDialog.PageWidth = 800
diagramView.DiagramPrintDialog.PageMargin = New Thickness(20,20,20,20)
diagramView.DiagramPrintDialog.PageStretch = Stretch.None
diagramView.PrintPreview()
NOTE
Printing works independently from PrintPreview, and shows the exact preview of the print out, but only when the printer settings and the PrintPreview settings (PageMargin, PageWidth, PageHeight) are the same.
PrintDialog
Prints can be made without having to go through a preview.
The diagram can be printed with a framework print dialog, i.e. without any preview (through code behind) as shown here:
DiagramView diagramView = new DiagramView();
diagramView.PrintDialog();
Dim diagramView As New DiagramView()
diagramView.PrintDialog()
DrawingTools
This feature enables you to draw different shapes and lines. The drawn shapes and lines will be converted into Node and LineConnector respectively.
The following shapes and lines are available in DrawingTools:
- Ellipse
- Rectangle
- Rounded Rectangle
- Polygon
- Straight Line
- Bezier Line
- Orthogonal Line
Use Case Scenarios
DrawingTools such as Microsoft Paint and Expression Blend support drawing a particular shape continually on a page. This feature too, enables you to draw a shape repeatedly without selecting it manually each time.
Properties
Property | Description | Type | Data Type | Reference Link |
---|---|---|---|---|
EnableDrawingTools | Gets or sets a value indicating whether EnableDrawingTools is enabled or dis abled. | Dependency property | Boolean(True/False) | NA |
DrawingTools | Gets or sets the ShapeType to be used. Default value isDrawingTools.Ellipse | Dependency property |
Enum
DrawingTools.Ellipse DrawingTools.Rectangle DrawingTool.RoundedRectangle DrawingTools.Polygon DrawingTools.StraightLine DrawingTools.BezierLine DrawingTools.OrthogonalLine DrawingTools.PolyLine |
NA |
Sample Link
To view a sample:
- Open the Silverlight sample browser from the dashboard.
- Navigate to SL Diagram -> Product Showcase -> Diagram Builder
Enable DrawingTools Property
To enable DrawingTools set the EnableDrawingTools property to true. Shapes and line connectors are enabled, when the EnableDrawingTools property is enabled. By default, the value is set to false.
DrawingTools can be enabled using two methods:
- Through XAML.
The following code illustrates how to enable the DrawingTools:
<syncfusion:DiagramControl Name="diagramControl"
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel">
</syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView Name="diagramView" EnableDrawingTools="True">
</syncfusion:DiagramView>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
- Through Code behind
The following code illustrates how to enable the DrawingTools:
DiagramView diagramView = new DiagramView();
diagramView. EnableDrawingTools = true;
NOTE
When the EnableDrawingTools is set to True, it has to be disabled manually, i.e. it cannot be disabled automatically. This will facilitate drawing shapes or lines continually until EnableDrawingTools is set to false manually.
Select a DrawingTool
DrawingTools consist of different shapes and line connectors. You can choose one of the DrawingTools at a time. By default, it is set to Ellipse.
The DrawingTool selection in Diagram View can be set in two methods:
- Through XAML.
The following code illustrates how to select a DrawingTool:
<syncfusion:DiagramControl Name="diagramControl">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel">
</syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView Name="diagramView" DrawingTool="Polygon">
<syncfusion:DiagramView.Page>
</syncfusion:DiagramView>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
- Through Code behind
The following code illustrates how to select a DrawingTool:
DiagramView diagramView = new DiagramView();
diagramView.DrawingTool = DrawingTools.Rectangle;
Steps for Drawing
You can draw on a page by click and drag on the page.
Follow are the below steps to draw a shape or a line:
- Set the EnableDrawingTools property of DiagramView to true.
- Select the DrawingTool as required from DrawingTools option.
- Click and drag. Preview of the drawing will be displayed.
- Release the mouse. Shape or line will be drawn.
NOTE
These steps are common for all shapes and lines drawing, except Polygon.
Shape Drawing:
Preview Ellipse – while Drawing
Ellipse Preview
Ellipse – After Drawing.
Ellipse(Node)
Line Drawing:
Bezier Line Preview – While Drawing
Bezier Line Preview
Bezier Line – After Drawing
Bezier Line(Line Connector)
NOTE
- The drawn shape will be converted into a Node.
- The drawn line will be converted into a LineConnector.
- You can continually draw the selected shape.
- Lines cannot be drawn continually.
Steps for drawing a Polygon Drawing:
- Set the EnableDrawingTools property of DiagramView to be true.
- Select the DrawingTool as required from DrawingTools option.
- Click, where you want the first point for polygon.
- Drag the mouse pointer. Preview of the drawing will be displayed.
- Click, where you want to place the Intermediate points of Polygon
- Right-click to complete the drawing.
Preview Polygon – While Drawing
Polygon Preview
Polygon – After Drawing
Polygon(Node)
Virtualization for Diagram Control
Virtualization is the process of loading the diagram page elements that are available in the visible area of the diagram control, i.e page elements that lie within the viewport of the ScrollViewer will be in loaded state and the rest will not be loaded until they come into view.
This feature gives optimizable performance while loading and dragging items to diagram control when many Nodes and LineConnectors are added in the diagram page.
Use Case Scenarios
The loading time and the UI response will be proportional to the number of elements used in a page. When you want to display a page with large number of Nodes and LineConnectors the processing speed will be slow in user interaction. If virtualization is enabled, application will load only elements that lie in the visible area. This leads to fast loading and fast user interactivity.
Properties
Property | Description | Type | Data Type | Reference links |
---|---|---|---|---|
EnableVirtualization | Gets or sets a value indicating whether the diagram page can be virtualized. The default value is set to false. | Dependency Property | Boolean | NA |
EnableCaching | Gets or sets a value indicating whether the loaded object in diagram page can be virtualized. The default value is true. | Dependency Property | Boolean | NA |
EnableVirtualization Property:
To enable virtualization, set the EnableVirtualization property of DiagramView to true. Page elements within the viewport alone will be loaded. The default value is false. Following code illustrates this:
<!---DiagramControl--->
<syncfusion:DiagramControl Name="diagramControl" >
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel" >
</syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView EnableVirtualization="True" Name="diagramView"
</syncfusion:DiagramView>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
DiagramView diagramView = new DiagramView();
diagramView.EnableVirtualization = true;
Dim diagramView As New DiagramView()
diagramView.EnableVirtualization = True
EnableCaching Property:
The EnableCaching property decides whether the element should be in loaded state or unloaded state, when the element is outside the viewport area. To set the element in unloaded state set the EnableCaching to false. To set it in loaded state set the EnableCaching to true.
Following code illustrates this:
DiagramView diagramView = new DiagramView();
diagramView.EnableCaching = true;
Dim diagramView As New DiagramView()
diagramView.EnableCaching = True
Node/LineConnector AllowVirtualization Property:
The AllowVirtualization property is used to enable/disable the Node/LineConnector virtualization. When the AllowVirtualization is set to false for an element that lies outside the viewport, it will be in loaded state when Virtualization is enabled. The default value is true.
The AllowVirtualization property can be set as given in the following code.
// Node Virtualization
Node NodeObject = new Node();
NodeObject.AllowVirtualization = true;
//LineConnector Virtualization
LineConnector LineConnectorObject = new LineConnector();
LineConnectorObject.AllowVirtualization = true;
'Node Virtualization
Dim NodeObject As New Node()
NodeObject.AllowVirtualization = True
'LineConnector Virtualization
Dim LineConnectorObject As New LineConnector()
LineConnectorObject.AllowVirtualization = True
Limitations:
Due to virtualization behavior there are some limitations in the diagram control. They are:
- As Gridlines and Rulers are not visualized, when node or line connector is placed at a distance for example 2,000,000 pixels away, rendering will take place from zero to end. This leads to performance issues in rendering Gridlines or Rulers.
- Save and load is not supported for Nodes and LineConnectors that are in unloaded state.
- When diagram is virtualized, many nodes will be in unloaded state and their Width and Height will not be set. As the automatic layout depends on the size of the node, predefined width and height for the node is required for updating the layout.
SizeToContent
SizeToContent support enables you to resize the diagram page depending upon the content size. This option can also be disabled. You can also define the size of diagram page and restrict the diagram element from moving out of a specified area.
Properties
Name | Description | Type | Data Type | Reference Links |
---|---|---|---|---|
SizeToContent | Specifies whether SizeToContent behavior is enabled or disabled. | Dependency Property | Bool | NA |
BoundaryConstraintsArea | Defines the diagram page area. | Dependency Property | Rect | NA |
BoundaryConstarintsEnabled | Restricts the diagram element moving out of a specified area. | Dependency Property | Bool | NA |
PageBackgroundEffect | Sets the page background effect. | Dependency Property | Effect | NA |
OffPageBackground | Sets the background brush for area outside Diagram Page. | Dependency Property | Brush | NA |
Enabling SizeToContent
To enable SizeToContent support, set the SizeToContent property of DiagramView to true. To disable, set this to false. Default value is true.
Following code illustrates how to enable SizeToContent support:
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel"></syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView SizeToContent="True" Name="diagramView"/>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
DiagramView diagramView = new DiagramView();
diagramView.SizeToContent = true;
Dim diagramView As New DiagramView()
diagramView.SizeToContent = True
Defining Diagram Page
You can define the Diagram Page area. Use the BoundaryConstraintsArea property of DiagramView to define Diagram Page area.
Following code illustrates how to define Diagram Page area:
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel"></syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView BoundaryConstraintsArea="100,100,850,1195" Name="diagramView"/>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
DiagramView diagramView = new DiagramView();
diagramView.BoundaryConstraintsArea = new Rect(100, 100, 850, 1195);
Dim diagramView As New DiagramView()
diagramView.BoundaryConstraintsArea = New Rect(100, 100, 850, 1195)
Restricting the Diagram Element
You can restrict the diagram element moving out of a specified area. Use the BoundaryConstraintsEnabled property of DiagramView for this purpose.
Following code illustrates how to restrict diagram element moving out of specific area:
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel"></syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView BoundaryConstraintsEnabled="True" Name="diagramView"/>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
DiagramView diagramView = new DiagramView();
diagramView.BoundaryConstraintsEnabled = true;
Dim diagramView As New DiagramView()
diagramView.BoundaryConstraintsEnabled = True
Customizing options
Following properties enables to customize the appearance of the diagram page:
- PageBackground – specifies the background of the diagram page.
- OffPageBackground - specifies the off page background.
- PageEffect - specifies the background effect of the diagram page.
Customizing Background
To customize the background, use the PageBackground of DiagramView. Default value is White.
Following code illustrated how to customize the background:
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel"></syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView OffPageBackground="White" PageBackground="White" Name="diagramView"/>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
DiagramView diagramView = new DiagramView();
diagramView.PageBackground = new SolidColorBrush(Colors.Gray);
Dim diagramView As New DiagramView()
diagramView.PageBackground = New SolidColorBrush(Colors.Gray)
Customizing the Off Page’s Background
To customize the background of the Off Page, use the OffPageBackground property of DiagramView. Default value is White.
Following code illustrates how to customize the background of the Off Page:
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel"></syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView OffPageBackground="White" PageBackground="White" Name="diagramView"/>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
DiagramView diagramView = new DiagramView();
diagramView.OffPageBackground = new SolidColorBrush(Colors.White);
Dim diagramView As New DiagramView()
diagramView.OffPageBackground = New SolidColorBrush(Colors.White)
Customizing page effect
To customize the page effect, use the PageEffect property of DiagramView.
Following code illustrates how to customize the page effect:
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel"></syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView OffPageBackground="White" PageBackground="White" Name="diagramView">
<syncfusion:DiagramView.BackgroundEffect>
<DropShadowEffect BlurRadius="12" Color="Black" Direction="-350" ShadowDepth="30"/>
</syncfusion:DiagramView.BackgroundEffect>
</syncfusion:DiagramView>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
DropShadowEffect drop = new DropShadowEffect();
drop.BlurRadius = 25;
drop.Color = new Color { B = 205, G = 148, R = 79 };
drop.Direction = 450;
drop.ShadowDepth = -2;
diagramView.BackgroundEffect = drop;
Dim drop As New DropShadowEffect()
drop.BlurRadius = 25
drop.Color = New Color With {.B = 205, .G = 148, .R = 79}
drop.Direction = 450
drop.ShadowDepth = -2
diagramView.BackgroundEffect = drop
Customized Diagram Page
Support to Delete Nodes and Connectors
Essential Diagram for Silverlight provides support to delete selected nodes and connectors.
Use Case Scenarios
When you restructure the workflow diagram, you may happen to delete some of the nodes and connectors. Using this feature you can deleted the unwanted nodes and connectors.
Sample Link
A demo of this feature is available in the following location:
{Installed Location}\Syncfusion\EssentialStudio__x.x.x.x\Silverlight\Diagram.Silverlight\ProductShowcase\DiagramBuilder
Deleting Nodes and Connectors
You can delete the nodes and connectors the following two methods:
- Using Delete Keyboard
- Using Delete Command
Using Delete Keyboard
This feature provides keyboard support to delete nodes and connectors:
The following steps illustrate how to delete nodes or connectors using keyboard:
1. Select the node or the connector to be deleted.
2. Press the Delete key. The selected node or connector will be deleted.
Using the Delete Command
You can also delete nodes and connectors through commands. To delete nodes and connectors, invoke the Delete command as illustrated in the following code:
diagramControl.Delete.Execute(diagramView);
diagramControl.Delete.Execute(diagramView);
NOTE
When a node is deleted, all the connectors connected to that node will also be deleted. Deleting a connector leads to the deletion of that particular connector only.
Zooming Support
Essential Diagram for Silverlight provides support for zoom in and zoom out the diagram page. This can be achieved in the following two methods:
- Using the zoom commands
- Using the mouse
Properties
Property | Description | Type | Data Type | Reference links |
---|---|---|---|---|
IsZoomEnabled | Gets or sets a value indicating whether zoom is enabled or not.Default value is True. | Dependency property | Boolean | NA |
ZoomFactor | Gets or sets a factor for the zoom.Default value is 0.2. | Dependency property | Double | NA |
Zooming Diagram Page
Through Zoom Commands
Zooming in
You can add the zoom in command to the Button click event as given in the following code:
DiagramView diagramView = new DiagramView();
ZoomCommands.ZoomIn.Execute(diagramView.Page, diagramView);
<Button Name="ZoomIn" Content="ZoomIn" Command="{Binding ZoomIn,ElementName=diagramControl}" Width="100" Height="30"/>
The diagram page elements will be zoomed in each time the button is clicked.
Zoom out
You can add the zoom out command to the Button click event as given in the following code:
DiagramView diagramView = new DiagramView();
ZoomCommands.ZoomOut.Execute(diagramView.Page, diagramView);
<Button Name="ZoomOut" Content="ZoomOut" Command="{Binding ZoomOut, ElementName=diagramControl}" Width="100" Height="30"/>
The diagram page elements will be zoomed out each time the button is clicked.
Through Mouse
You can enable the zooming through mouse scrolling. To enable this set the IsZoomEnabled property to True. By default it is set to true.
The following code illustrates this:
DiagramView diagramView = new DiagramView();
diagramView.IsZoomEnabled = true;
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True"
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel">
</syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView Name="diagramView" IsZoomEnabled="True">
</syncfusion:DiagramView>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>
When to code runs, zooming will be enabled. To zoom in, Ctrl + scroll up the diagram page. To zoom out, Ctrl + scroll down the diagram page.
NOTE
Enabling IsZoomEnabled property will not affect the performed of any other operations on the page elements.
Zoom Factor
Essential Diagram Silverlight allows you to set the factor. you can set the zoom factore using the ZoomFactor property. The default value is 0.2.
The following code illustrates how to set the zoom factor:
DiagramView diagramView = new DiagramView();
diagramView.ZoomFactor = 1;
<syncfusion:DiagramControl Name="diagramControl" IsSymbolPaletteEnabled="True">
<syncfusion:DiagramControl.Model>
<syncfusion:DiagramModel x:Name="diagramModel">
</syncfusion:DiagramModel>
</syncfusion:DiagramControl.Model>
<syncfusion:DiagramControl.View>
<syncfusion:DiagramView Name="diagramView" ZoomFactor="1">
</syncfusion:DiagramView>
</syncfusion:DiagramControl.View>
</syncfusion:DiagramControl>