How to Update TreeViewItem's IsExpanded property to false in code behind?

Posted by viky on Stack Overflow See other posts from Stack Overflow or by viky
Published on 2010-04-05T09:16:06Z Indexed on 2010/04/05 9:23 UTC
Read the original article Hit count: 232

Filed under:
|
|
|

I am working with WPF TreeView control. I am creating a hierarchical data structure and assigning it to ItemsSource and it will generate TreeviewItems automatically. By default I use IsExpanded of TreeViewItem to true. But in a particular case, I want to set IsExpanded property to false. So that treeview loading doesn't take time to generate all items. How can I set that in code since I don't have reference to TreeViewItem's instance at that time?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf