I have a viewmodel with ObservableCollection<PersonViewModel> on it. PersonViewModel.Name is what I want to show.
I want a tree bound and showing the person names, but I want a root node called "Person Root" (so one collapsible root with names under it)
-Person Root
+Greg
+Tom
etc.
Is this possible in xaml with data binding without modifying my viewmodel structure?
Hi,
Did you try something like the following XAML:
<igTree:XamWebTree x:Name="TestXamWebTree">
<igTree:XamWebTreeItem Header="Person Root" ItemsSource="{Binding}">
<igTree:XamWebTreeItem.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</igTree:XamWebTreeItem.ItemTemplate>
</igTree:XamWebTreeItem>
</igTree:XamWebTree>
HTH,
One caveot to the question, how can this be applied when using hierarchical templates? e.g. Persons->Jobs
nm got it, wrap the hierarchy stuff in
<ig:XamTreeItem Header="MyHeader" IsExpanded="True" ItemsSource="{Binding}">
and then
<ig:XamTreeItem.HierarchicalItemTemplate>