Dim flatHierarchy As IEnumerable(Of OrgChartNode) = orgChart.RootNode.HighlightChildren(orgChart.ActualDepth)
The OrgChartNode objects have the following methods facilitating the traversal of nodes:
fromNode.Highlight(OrgChartNode toNode) – returns a collection of OrgChartNode objects that represent the path between the source and destination node. This method can be also called on the xamOrgChart™ control – orgChart.Highlight(OrgChartNode fromNode, OrgChartNode toNode).
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.
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.
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);