Hi all,
I am using a treeview bound to a hierarchy of ObservableCollections, and the bindings appear fine (including to a dependency property IsExpanded on the objects, and a pdependency property SelectedNode on the hierarchy as a whole) apart from one issue. My user can select a node and a control that fires this method:
public void NewConsolidation(object args)
{
SelectedNode.IsExpanded = true;
var newNode = _hierarchy.AddNode(SelectedNode, "Another Child"); <-- inserts a node
SelectedNode = newNode;
SelectedNode.ParentNode.IsExpanded = true;
SelectedNode.ParentNode.NodeName += "(has children)";
}
With more than one node, collapsed, I see
+ Root Node <-- selected
go to
- Root Node (has children)
First Child
Another Child <-- selected
but with only the root:
Root Node <-- selected
goes to
+ Root Node (has children)
- that is, setting IsExpanded makes no difference if the node in question has never had children and been opened. I can see the binding is working, though, because the name change takes effect. I understand this is related to the treeview items not yet being generated - so how can I force them to be generated for this parent?
I am using a treeview bound to a hierarchy of ObservableCollections, and the bindings appear fine (including to a dependency property IsExpanded on the objects, and a pdependency property SelectedNode on the hierarchy as a whole) apart from one issue. My user can select a node and a control that fires this method:
public void NewConsolidation(object args)
{
SelectedNode.IsExpanded = true;
var newNode = _hierarchy.AddNode(SelectedNode, "Another Child"); <-- inserts a node
SelectedNode = newNode;
SelectedNode.ParentNode.IsExpanded = true;
SelectedNode.ParentNode.NodeName += "(has children)";
}
With more than one node, collapsed, I see
+ Root Node <-- selected
go to
- Root Node (has children)
First Child
Another Child <-- selected
but with only the root:
Root Node <-- selected
goes to
+ Root Node (has children)
- that is, setting IsExpanded makes no difference if the node in question has never had children and been opened. I can see the binding is working, though, because the name change takes effect. I understand this is related to the treeview items not yet being generated - so how can I force them to be generated for this parent?