This sample reads XML data and produces a diagram of two trees sharing a single root node.

The XML data, in this sample stored as an embedded resource file, consists of nested elements describing nodes. Unlike the typical XML data, the nesting of the node elements implicitly defines the tree structure.

Unlike most diagrams, there are actually four separate TreeLayouts responsible for positioning the nodes, all held by a MultiLayout. Each tree layout grows at different angles and works on a subset of the nodes. The immediate children of the XML element ROOT node have a "dir" attribute that describes the direction that subtree should grow. This information is used to bind the go:Part.LayoutId attached property in the node template to identify which DiagramLayout should apply to that node, matching the layout "Id" property.