Version

Customizing Individual Nodes

Introduction

The nodes of the xamOrgChart™ are visualized using the OrgChartNodeControl. When a node is moved outside of the visible area of the Org Chart, the OrgChartNodeControl related to it is disposed. When a node is moved inside the visible area, a new OrgChartNodeControl is created.

The data for the nodes is stored in OrgChartNode objects. When a new OrgChartNodeControl is created, it is linked to an OrgChartNode object. The visual styles of the nodes are stored in the OrgChartNode items and can be assigned directly or through Node Layouts.

Configuring the Properties of Individual Nodes

When binding to data, the Node Layouts can be used to apply different settings to the nodes of the Org Chart. Some settings can also be applied to individual nodes as the visibility and style of the Expansion Indicator and the style of the OrgChartNodeControl related to the node.

The children of a node can be collapsed from code using the IsExpanded property of the node.

Each node carries information about its level in the hierarchy and its parent and children nodes. The information is useful when implementing a custom traversal of the nodes.

The xamOrgChart has a RootNode property, which returns the root OrgChartNode object. This object doesn’t have a visual representation – it acts as the parent of the actual root nodes. The Root Node can be used as a starting point for node traversal.

The code below converts the Org Chart’s hierarchy to a flat collection of OrgChartNode objects starting from the Root Node:

In Visual Basic:

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

In C#:

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