开发者

Silverlight 4 Treeview MVVM WCF

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 开发者_如何学Pythonservice.

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


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}"


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜