c# - Expand a treeViewItem Automatically -


I have a TreeView that I have filled with the list of TreeViewItem from the collection (using bindings), I have a tree view Expand it to "extend" and display your children, my purpose is to get to the last TreeViewItem and consult the previous tree ViewItem to start TreeView. I can retrieve the final TreeViewItem consultation and their children, but I can not expand it automatically. I use this method, but it always remains empty.

TreeViewItem item = control.ItemContainerGenerator.ContainerFromItem (lastItem) as TreeViewItem; Item.IsPanded = true;

The item is always empty, the extended dose does not work, and it is a string (text that you see on the screen: Tree ViewItem.datacontext is recovred).

You should read what makes all your tasks easier with TreeView and TreeViewItem controls Will give


Comments