Search
Accessing Items

One of the most common tasks when using the component is iterating over all items in the diagram document or navigating through the connections between items  from a node to the incoming or outgoing links, or from a link to its origin and destination nodes. To enumerate items of a diagram use the Items, Links or Nodes collections. The nodes that a link connects are referenced by the link's Destination and Origin properties. To access the links that are connected to a node, use its IncomingLinks and OutgoingLinks collections. The first collection contains references to all links pointing to the node, the second  to the links that start from it. Links can connect to rows of a table; to find such links use table's Rows collection and the IncomingLinks and OutgoingLinks collections. A shortcut for accessing the other end of a relation in entity-relationship diagrams is provided by the RelatedOneToMany and RelatedManyToOne properties of the Row class.

Selected Items

If only one item is selected, it is considered the active item and can be accessed with the ActiveItem property. The type of this property is DiagramItem; you can get the actual type of the selected item through reflection. Multiple items can be selected when dragging by selecting the appropriate behavior. Multiple selection is represented by the Selection property of the Diagram class. The Selection object provides collections to access the selected Links and Nodes.

Finding Items

You can search for diagram items by their Tag or Id using the FindLink, FindNode, FindLinkById and FindNodeById methods. Tag and id objects are compared by calling the Equals method of the System.Object class. Thus if they are of value type, they are compared by value (that is bitwise equality). If they are of reference type their Equals method is used.  If there are more items with the same tag, the first one will be returned. If no item with the specified tag or id exists, a null reference will be returned.