private void grid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { AElement obj = grid.SelectedItem as AElement; if (obj == null) { return; } tree.Items.Clear(); obj.AddChildsToTree(tree.Items); foreach (var it in tree.Items) { ExpandAll(it as TreeViewItem); } }
public override void AddChildsToTree(ItemCollection items) { if (target == null) { items.Add(new TreeViewItem() { Header = "<ref not loaded>" }); return; } if (isRecursing) { return; // Infinite recursion } isRecursing = true; target.AddChildsToTree(items); isRecursing = false; }