Accessing Items
Items in the diagram are exposed via its nodes
and links
members. nodes contains all DiagramNode
-derived objects that have been added to the diagram, and links contains all DiagramLink
objects. By iterating these arrays, you can access all diagram elements and apply common attributes to them:
// paint all nodes with red color
for node in diagram.nodes
{
node.brush = SolidColorBrush(color: Colors.Red)
}
// set the links' arrowheads to triangles
for link in diagram.links
{
link.headShape = Shape.fromId(id: "Triangle")
}
Individual items provide methods that let you access their related items in the diagram. DiagramNode
exposes the links coming into or going out of nodes via the getAllIncomingLinks
and getAllOutgoingLinks
methods. The nodes connected by a link can be accessed by means of the origin
and destination
properties of DiagramLink
.
The component lets users select multiple diagram items of interest. The selectedItems
property of Diagram
returns DiagramItem
s representing the currently selected items.