开发者

Silverlight TreeView with Multiple Objects

I am having a bit of an issue with the TreeView in SilverLight.

I need to be able to have multiple datatemplates on the tree because different objects are going to need to display different data on the tree. This isn't possible right out of the gate in Silverlight so I had to use a hierarchical data template selector (I got my template from here).

This works fine for getting down one level but after that I am having some troubles.

I want the tree to look like:

Group
+----Category
|--------Report1
+----Category
+--------Report2
|--------------Information

That is to say, I want some Reports to be able to drill down another level on the tree. However, when I try to select another hierarchicalDataTemplate using my DataTemplateSelector, it will not display the children... it seems like it is ignoring the ItemSource

On 'Report2' the DataTemplateSelector selects a template that looks like this:

<sdk:HierarchicalDataTemplate x:Key="SubscriptionTemplate" ItemsSource="{Binding Path=Children}" ItemTemplate="{StaticResource SubscriptionChildTemplate}" >

<TextBlock Text="{Binding Path=Category}" Fon开发者_StackOverflow社区tWeight="Bold" />

</sdk:HierarchicalDataTemplate>

If anyone can explain how to do this, or why I can't, or can give me some good tips for debugging this (I am relatively new to Silverlight) that would be excellent.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜