Snapping

Defines the gridlines and defines how and when the objects have to be snapped.

Please refer to the SnapSettings properties.

Snap To Objects

The snap-to-object provides visual cues to assist with aligning and spacing Diagram. A Node can be snapped with its neighboring objects based on certain alignments(same size,same position). Such alignments are visually represented as smart guides.

Snapping to objects can be enabled by assigning values other than SnapToObject.None to SfDiagram.SnapSettings.SnapToObject.

//Enables or disables the default behaviors of the Snapping with objects in SfDiagram.
diagram.SnapSettings.SnapToObject = SnapToObject.All;

Snap to object

Please refer to the members of SnapToObject.

Gridlines

Gridlines are the pattern of lines drawn behind the Diagram elements. It provides a visual guidance while dragging or arranging the objects on the Diagram surface.

Customize the gridlines visibility

The SnapConstraints property of SnapSettings enables you to show/hide the gridlines.

<!--Initialize SfDiagram-->
<diagram:SfDiagram x:Name="diagram"> 
  <!--Initialize SnapSettings-->		
  <diagram:SfDiagram.SnapSettings>
    <diagram:SnapSettings SnapConstraints="ShowLines"/>
  </diagram:SfDiagram.SnapSettings>
</diagram:SfDiagram>
//Shows both Horizontal and Vertical Gridlines
diagram.SnapSettings.SnapConstraints = SnapConstraints.ShowLines;

Snap to Gridlines

Appearance

Options are provided to customize the Style and LineIntervals of Gridlines.

Please refer to the Gridlines properties.

Please refer to the KB link for Gridlines customization

Snap To Lines

This feature allows the Diagram objects to snap to the nearest interaction of gridlines while being dragged or resized. This feature enables easier alignment during layout or design.

Snapping to gridlines can be enabled/disabled with the SnapConstraints property of SnapSettings.

//Enables snapping to both the horizontal and vertical lines.
diagram.SnapSettings.SnapConstraints = SnapConstraints.SnapToLines;