I've used the TreeView
control for a project and it's been really useful for me! You've saved a lot of hard work, so I wanted to thank you in the first place :)
I need to fill a TreeView
using a custom UserControl
which, among other fields, has a button
that must perform as the ExpanderButton
.
Here's the DataTemplate
from which the TreeView page is filled:
<DataTemplate
x:Key="TreeViewItemTemplate">
<data:DataTemplateExtensions.Hierarchy>
<data:HierarchicalDataTemplate
ItemsSource="{Binding Children}" />
</data:DataTemplateExtensions.Hierarchy>
<Grid>
<components:VideoSessions Title="{Binding Title}"
Start="{Binding Start}"
End="{Binding End}"
Status="{Binding Status}"
HasHighlights="{Binding HasHighlights}"/>
</Grid>
</DataTemplate>
How could I bind the behavior of the ExpanderButton
to my control?
Thanks in advance!
The
TreeView
control has anIsExpandedBindingPath
property (as used in here) that you could use to bind the expanded state of theTreeViewItems
to your backing tree node models. You could thenTwoWay
-bind the toggle state of yourExpanderButton
to that same property on the tree node model.