Reputation: 431
I want be able to expand certain node in a WPF TreeView tree. The tree items are contained in an ObservableCollection list.
Upvotes: 0
Views: 447
Reputation: 2956
TreeViewItem
has a property IsExpanded
you can bind the property with your ObservableCollection
object property and handle it from your ViewModel
.
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpandedProp}" />
</Style>
ViewModel
public bool IsExpandedProp
{
get { return _IsExpandedProp; }
set { _Values = _IsExpandedProp; NotifyPropertyChanged(); }
}
Upvotes: 1