C
C#9mo ago
Alex

✅ TreeViewItem Expanded event in MVVM

I want to execute command LoadSubDirectories when TreeViewItem is expanded, but I don't understand how can I do it in MVVM, where should I bind command?
<DockPanel>
<TreeView ItemsSource="{Binding Items}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate
DataType="{x:Type models:NavigationPaneItem}"
ItemsSource="{Binding Children}"
>
<TextBlock Text="{Binding Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<DockPanel>
<TreeView ItemsSource="{Binding Items}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate
DataType="{x:Type models:NavigationPaneItem}"
ItemsSource="{Binding Children}"
>
<TextBlock Text="{Binding Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server