public void Bind(INode root) { List <INode> nodes = new List <INode>(); NodeTree.Flatten(root, nodes); // Build dictionary. Dictionary <string, INode> nodeDictionary = new Dictionary <string, INode>(); for (int i = 0; i < nodes.Count; i++) { INode node = nodes[i]; if (string.IsNullOrEmpty(node.Name)) { continue; } if (nodeDictionary.ContainsKey(node.Name)) { continue; } //if (nodeDictionary.ContainsKey(node.Name)) throw new InvalidOperationException("The node tree can not contain two nodes with the same name."); nodeDictionary.Add(node.Name, node); } Bind(Timeline, nodeDictionary); }