private void expectedObjectTree_Expanded(object sender, ObjectFieldEventArgs e) { ObjectField otherField = currentObjectTree.GetEquivalentField(e.ObjectField); if (toolStripButtonSynchronizeTrees.Checked) { // Synchronize with the other tree view currentObjectTree.Expand(otherField); } bool openOther = true; if (otherField != null) { ObjectFieldCollection otherCollection = otherField as ObjectFieldCollection; if (otherCollection != null && otherCollection.Count > 1) { openOther = false; } } ObjectFieldCollection collection = e.ObjectField as ObjectFieldCollection; if (collection != null && collection.Count == 1 && (openOther || !toolStripButtonSynchronizeTrees.Checked)) { expectedObjectTree.Expand(collection.Childs.First()); } }
private void currentObjectTree_SelectionChanged(object sender, ObjectFieldEventArgs e) { if (toolStripButtonSynchronizeTrees.Checked && e.ObjectField != null) { // Synchronize with the other tree view ObjectField otherField = expectedObjectTree.GetEquivalentField(e.ObjectField); expectedObjectTree.SelectedField = otherField; } }
private void currentObjectTree_Collapsed(object sender, ObjectFieldEventArgs e) { if (toolStripButtonSynchronizeTrees.Checked) { // Synchronize with the other tree view ObjectField otherField = expectedObjectTree.GetEquivalentField(e.ObjectField); expectedObjectTree.Collapse(otherField); } }