I have a user control with a tree view with data template.
I fill the tree view in a constructor like this:
var works = new WorksTreeViewItem();
var world = new WorldTreeViewItem
{
// ...
};
WorldOrWorksTreeViewItems = new ObservableCollection<WorldOrWorksTreeViewItem>
{
world,
works
};
How can I set the world treeViewItem expanded?
I have tried expand each treeVeiwItem at least with this code in TreeView in xaml:
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="True"/>
</Style>
but after that, the treeView has only one item with text: treeviewitem
I have found out, that I can use this:
But that expands everything and I want to expand just some of them.
I guess I should use x:Key, but it doesnt want to compile, even if that is what I have found in the official website for ControlTheme.