The Tree Layout sample demonstrates organizing nodes into layers with many options. The graph is assumed to be structured as a tree. If it sees secondary links coming into a node, it ignores them.

Modifying one of the properties will automatically perform another layout using the new property value, because the values of the TreeLayout properties are data-bound to the controls in the sample. There are two sets of tree layout properties, the "Root" defaults and the "Alternate" defaults.

The TreeStyle property governs the general layout of the tree:

    Layered: The default style for TreeLayout which ignores all Alternate" properties and lines up children horizontally or vertically.
    LastParents: The same as Layered except that nodes with children but no grandchildren use the Alternate" properties.
    Alternating: Alternates between the "Root" properties and the "Alternate" properties.
    RootOnly: The root node uses the "Root" properties; all other nodes use "Alternate" properties.

Angle sets the angle at which the trees grows for greater depth. It can be 0 degrees (rightward), 90 (downward), 180 (leftward) or 270 (upward).

Alignment controls the relative position of the parent node compared to its children.

NodeSpacing controls the amount of space between siblings. NodeIndent specifies how much empty space to leave at the beginning of the children; this only applies if the Alignment is Start or End. NodeIndentPastParent specifies whether the indentation should include some fraction of the breadth of the parent.

LayerSpacing controls the amount of space between the layers. This should normally be greater than 20. LayerSpacingParentOverlap specifies the fraction of the parent's depth that the children's layer should overlap with the parent's layer. This is usually used only when the indentation is large enough to avoid actual overlap of any child nodes with the parent node.

Sorting controls whether the children of each parent are sorted, and in which order.

Compaction determines whether the layout should try to squeeze adjacent subtrees closer together, without overlapping any nodes.

Tree layouts tend to get very broad. To help avoid this, TreeLayout can lay out children into multiple rows. Usually, the Alignment should be Start or End. To enable breaking layers of children into rows, set the BreadthLimit. BreadthLimit will not affect nodes in a bus. RowSpacing controls the distance between rows, or distance between the rows of nodes in a bus. RowIndent specifies the indentation for each row, to permit room for the links to be routed around previous rows.