Search
Alignment Grid

WpfDiagram provides an alignment grid to help users place the diagram items more precisely. To activate the grid, set the AlignToGrid property to true. If the grid is active while an item is being created or modified, the item's control-points are aligned to the nearest grid points. The distance between adjacent grid points is set by the GridSizeX and GridSizeY properties. The GridOffsetX and GridOffsetY properties allow specifying the horizontal and vertical offset of the first point in the alignment grid.

Items created or modified by a user are automatically aligned to the grid. However, if items are placed in the diagram programmatically, their coordinates are set to the specified positions without aligning. In such cases use AlignPointToGrid if items must be placed exactly at grid points.

The grid can be either visible or invisible, depending on whether the ShowGrid value is true or false. If visible, the grid is painted as a matrix of points or as series of crossing lines, as specified by the GridStyle property. GridPen defines the pen with which the alignment points or lines are drawn.