1
votes

I'm having an issue with the treeview control from the silverlight 4 toolkit. I can't get it to view to display my data correctly, the toplevel items are shown but the childnodes are nowhere to be seen.

More info: I have a wcf service that delivers a list of Categories with nested subcategories to my viewmodel (I made sure to explicitly include my subcategory data). My viewmodel has an observable list property (wich is named Categories) with this data from my WCF service.

My ViewModel: _http://pastebin.com/0TpMW3mR My XAML: http://pastebin.com/QCwVeyYu

2

2 Answers

0
votes

Unless it is a copy error, your bindings have typos (missing s's) - referring to:

ItemsSource="{Binding Path=Categorie.SubCategorie}" 

instead of

ItemsSource="{Binding Path=Categories.SubCategories}"
0
votes

You have forgotten to specify an ItemsSource property inside MainItemTemplate:

    <sdk:HierarchicalDataTemplate x:Key="MainItemTemplate" 
         ItemsSource="{Binding NameOfSubCategoriesProperty}"
         ItemTemplate="{StaticResource SubItemTemplate}">
        <TextBlock Text="{Binding Path=CategoryId}" Foreground="Blue"/>
    </sdk:HierarchicalDataTemplate>

NameOfSubCategoriesProperty probably is Categorie.SubCategorie or SubCategories, but I don't have a model class and I can't say exactly.