Version

Highlight Methods

The OrgChartNode objects have the following methods facilitating the traversal of nodes:

Note
Note:

The returned collection includes the source and destination nodes.

  • fromNode.HighlightChildren(int levels) – returns a collection of OrgChartNode objects that represent all child nodes relative to the source node. In (int levels), levels is the number of the hierarchy’s levels below the source node.

Note
Note:

The returned collection does not include the source node.

  • fromNode.HighlightParents(int levels) – returns a collection of OrgChartNode objects that represent all parent nodes relative to the source node. In (int levels), levels is the number of the hierarchy’s levels above the source node.

Note
Note:

The returned collection does not include the source node.

Note
Note:

The collections that the Highlight methods return do not have a hierarchical structure – the hierarchy is flattened.

Code Example

The code below converts the OrgChart’s hierarchy to a flat collection of OrgChartNode objects:

In Visual Basic:

Dim flatHierarchy As IEnumerable(Of OrgChartNode) = orgChart.RootNode.HighlightChildren(orgChart.ActualDepth)

In C#:

IEnumerable<OrgChartNode> flatHierarchy = orgChart.RootNode.HighlightChildren(orgChart.ActualDepth);