Click here to Skip to main content
15,891,694 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How we can expend all the nodes of WPF treeview once i have bound it to object. I have used code below

C#
for (int i = 0; i < TreeViewLocal.Items.Count;i++)
            {
                TreeViewItem t2 = (TreeViewItem)TreeViewLocal.ItemContainerGenerator.ContainerFromItem(TreeViewLocal.Items[i]);
                t2.IsExpanded = true;
            }


But as you can see it will expends top level nodes.Any help on this highly appreciated
Posted

This[^] will surely help you out.
 
Share this answer
 
Comments
CS2011 21-Oct-11 9:16am    
Thanks for your help Man
Abhinav S 21-Oct-11 9:22am    
You are welcome.
Try setting manually the IsExpanded property to IsTrue for every TreeViewItem you add to your TreeView.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900