The layout subsystem provides automatic positioning of components within containers.

Available Layouts

  • FlowLayout: Left-to-right, top-to-bottom wrapping (like HTML inline flow)
  • GridLayout: Fixed column count grid with configurable cell sizes
  • StackLayout: Vertical or horizontal stacking with spacing and alignment

All layout engines implement ILayoutManager which exposes Layout(List). Layouts recalculate positions on component add/remove/resize events.

Automatic Layout Engines

The layout engines compute positions for every component from the graph structure. Each implements the auto-layout contract and can be run over the current selection or the whole diagram.

ForceDirectedLayout

Force-directed layout for network graphs. Uses simple spring-electric repulsion/attraction to position nodes.

MemberKindDescription
int IterationsPropertyGets or sets the iterations.
float RepulsionStrengthPropertyGets or sets the repulsion strength.
float AttractionStrengthPropertyGets or sets the attraction strength.
float IdealEdgeLengthPropertyGets or sets the ideal edge length.
float DampingPropertyGets or sets the damping.
float CenterXPropertyGets or sets the center x.
float CenterYPropertyGets or sets the center y.
void Arrange(IReadOnlyList<SkiaComponent> components, IReadOnlyList<IConnectionLine> lines)Method

HierarchicalLayout

Hierarchical (layered Sugiyama-style) auto-layout for flowcharts and DAG diagrams. Places nodes in layers based on longest path from sources, then minimizes crossings.

MemberKindDescription
bool TopToBottomPropertyGets or sets the top to bottom.
float LayerSpacingPropertyGets or sets the layer spacing.
float NodeSpacingPropertyGets or sets the node spacing.
float StartXPropertyGets or sets the start x.
float StartYPropertyGets or sets the start y.
void Arrange(IReadOnlyList<SkiaComponent> components, IReadOnlyList<IConnectionLine> lines)Method

RadialLayout

Radial auto-layout for MindMap diagrams. Children radiate outward from a central node at configurable angles and radius.

MemberKindDescription
float MinRadiusPropertyGets or sets the min radius.
float RadiusIncrementPropertyGets or sets the radius increment.
float StartAnglePropertyGets or sets the start angle.
float SweepAnglePropertyGets or sets the sweep angle.
void Arrange(IReadOnlyList<SkiaComponent> components, IReadOnlyList<IConnectionLine> lines)Method

GridAutoLayout

Grid layout for UML class diagrams and similar structured layouts.

MemberKindDescription
int ColumnsPropertyGets or sets the columns.
float HorizontalSpacingPropertyGets or sets the horizontal spacing.
float VerticalSpacingPropertyGets or sets the vertical spacing.
float StartXPropertyGets or sets the start x.
float StartYPropertyGets or sets the start y.
void Arrange(IReadOnlyList<SkiaComponent> components, IReadOnlyList<IConnectionLine> lines)Method

FlowLayout

A layout manager that arranges components in a flow, similar to text flow. Components are placed horizontally until there's no more space, then wrap to the next line.

MemberKindDescription
float HorizontalSpacingPropertyGets or sets the horizontal spacing between components.
float VerticalSpacingPropertyGets or sets the vertical spacing between rows of components.
void Layout(IEnumerable<SkiaComponent> components, SKRect bounds, float padding = 0)MethodLays out the specified components within the given bounds. The components to layout. The bounds in which to layout the components. The padding around the layout area.

GridLayout

A layout manager that arranges components in a grid with a fixed number of columns.

MemberKindDescription
int ColumnsPropertyGets or sets the number of columns in the grid.
float HorizontalSpacingPropertyGets or sets the horizontal spacing between components.
float VerticalSpacingPropertyGets or sets the vertical spacing between components.
GridLayout() { }MethodInitializes a new instance of the GridLayout class.
GridLayout(int columns)MethodInitializes a new instance of the GridLayout class with specified columns. The number of columns in the grid.
void Layout(IEnumerable<SkiaComponent> components, SKRect bounds, float padding = 0)MethodLays out the specified components within the given bounds. The components to layout. The bounds in which to layout the components. The padding around the layout area.

StackLayout

A layout manager that arranges components in a stack, either vertically or horizontally.

MemberKindDescription
Orientation OrientationPropertyGets or sets the orientation of the stack.
float SpacingPropertyGets or sets the spacing between components.
StackLayout() { }MethodInitializes a new instance of the StackLayout class.
StackLayout(Orientation orientation)MethodInitializes a new instance of the StackLayout class with specified orientation. The orientation of the stack.
void Layout(IEnumerable<SkiaComponent> components, SKRect bounds, float padding = 0)MethodLays out the specified components within the given bounds. The components to layout. The bounds in which to layout the components. The padding around the layout area.