CollapseAll items of a treeview within Wpf application

Viewed 6102

I have a WPF application , in which i have a treeview control .

I'd like to collapse all the items by clicking into a button. I tried this:

 private void buttonParam_Click(object sender, RoutedEventArgs e)
        {
//handling
    this.arborescence.IsExpanded = false;
        }

but it didn't worked. What are the reasons of this error? How can i change my snippet to do this task?

2 Answers
Related