hello,
kindly i want to ask about how can i get the nodes count of XamOrgChart.
thank you
Hello,
You can use a recursive function to count the nodes:
private int GetNodeCount(Infragistics.Controls.Maps.OrgChartNode node){ int count = 0; if (node != null) { count = 1; foreach (var childNode in node.ChildNodes) { count += GetNodeCount(childNode); } } return count;}
Let me know if you have any questions with this matter.
thank you for u replay
where can i call this function and how can i cast XamOrgChart to OrgChartNode?
thank you,
it worked perfectly
You can call this method anywhere in code where you want the count of the nodes. For the questions about casting, this isn't possible as the XamOrgChart and OrgChartNode are different objects. You can use the RootNode property of the XamOrgChart to get the root node and pass that into the function.