WPF: Tree Expansion key combination
Hi all I have created the WPF Tree which has three level of nodes.
Each will expand on mouse click or use of "+" key: With use of "TreeViewItem.Expanded".
Now I want to code Expansion of tree at load time. This is to save the Click of User to get the information.
I want to know below things from SO:
- Is there is any combination of key which will Expand all the tree nodes(As "+" will expand the 开发者_StackOverflow中文版one level of tree).
- Or Is there is any property to generate the Event for the expansion of nodes.
- No, nothing built in.
- No, again nothing built in.
That being said, it's a fairly trivial matter to intercept a key press event and enumerate your nodes and set the TreeViewItem.Expanded = true;
.
TreeViewItem.ExpandSubTree will expand the item and all of its children. If the TreeViewItem happens to be the root item, the entire tree will be expanded.
精彩评论