You could try something like that:
private RadTreeNode GetParentNode(RadTreeNode currentNode) {
if (currentNode.Parent!=null) {
return GetParentNode(currentNode.Parent);
}
return currentNode;
}
private void CountSelectedNodes(RadTreeNode firstNode, ref int selectedCount) {
if (firstNode.Nodes!=null) {
foreach(RadTreeNode node in firstNode.Nodes) {
CountSelectedNodes(node, ref selectedCount);
}
if (firstNode.IsSelected) {
selectedCount+=1;
}
}
}
private bool SelectionAllowed(RadTreeNode currentNode) {
RadTreeNode treeNode=GetParentNode(currentNode);
int selectedCount;
CountSelectedNodes(treeNode, ref selectedCount);
return selectedCount<=8;
}
(this code is not tested so there could be some bugs)
Call selectionAllowed() with the Node currently clicked