Gridlines in Xamarin.Android Diagram
30 Sep 2020 / 1 minute to read
Gridlines are the pattern of lines drawn behind the diagram elements. It provides a visual guidance when dragging or arranging the node on the diagram surface.
The “ShowGrid” property in PageSettings will show or hide the gridlines. The following code example illustrates how to enable grid visibility.
diagram.PageSettings.ShowGrid = true;
Grid cell size and gridline color can be modified using the “GridSize” and “GridColor” properties respectively. The following code example illustrates how to customize the grid.
diagram.PageSettings.GridColor = Color.Pink; diagram.PageSettings.GridSize = 14;
Nodes can be aligned and resized easily using gridlines by enabling the snap to grid. The following code example illustrates how to enable the snap to grid.
diagram.PageSettings.SnapToGrid = true;