/// <summary> /// Synchronizes the state of a node and its child nodes. /// </summary> /// <param name="otherField">The current field from the other tree view.</param> /// <param name="otherTree">The source tree view.</param> private void SynchronizeTreeView(ObjectField otherField, ObjectTree otherTree) { if (otherField == null) { return; } TreeNodeAdv otherNode = otherTree.trvTree.FindNodeByTag(otherField); TreeNodeAdv equivalentNode = trvTree.FindNodeByTag(GetEquivalentField(otherField)); if (otherNode != null && equivalentNode != null) { equivalentNode.IsExpanded = otherNode.IsExpanded; equivalentNode.IsSelected = otherNode.IsSelected; } foreach (ObjectField childField in otherField.Childs) { SynchronizeTreeView(childField, otherTree); } }
/// <summary> /// Synchronizes the state of this tree view with the given one. So nodes /// which are expanded on the source tree view will expanded here and so on. /// </summary> /// <param name="otherTree">The source tree view.</param> public void SynchronizeTreeView(ObjectTree otherTree) { SynchronizeTreeView(otherTree.TreeModel.Root, otherTree); }