This is a migrated thread and some comments may be shown as answers.

Problem with HeirararchicalDataTemplate

1 Answer 17 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 18 Nov 2011, 01:31 PM
Trying to set up a RadTreeView using telerik:HeirarchicalDataTemplate, can't use the Key attribute as it gives an error (Key attribute can only be used on a tag contained in an IDictionary type property).

Suggestions?

Jonathan

<telerik:HierarchicalDataTemplate x:Key="EventItemTemplate">
    <TextBlock Text="{Binding EventItemDescription}" />
</telerik:HierarchicalDataTemplate>
<telerik:HierarchicalDataTemplate x:Key="CategoryTemplate" ItemTemplate="{StaticResource EventItemTemplate}" >
    <TextBlock Text="{Binding CategoryName}" />
</telerik:HierarchicalDataTemplate>
<telerik:RadTabItem Header="Tree View" HorizontalAlignment="Stretch" Name="tabTreeView" Background="#FF84CBEA" VerticalAlignment="Stretch">
    <telerik:RadTreeView Name="radTreeView1" 
                         HorizontalAlignment="Stretch" 
                         VerticalAlignment="Stretch" 
                         ItemsSource="{Binding Data, ElementName=webAV}" 
                         ItemTemplate="{StaticResource CategoryTemplate}">
    </telerik:RadTreeView>
</telerik:RadTabItem>

1 Answer, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 18 Nov 2011, 02:11 PM
Ok solved it myself, forgot to put the HeirarchicalDataTemplate declarations in a Resource block...

Tags
TreeView
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Share this question
or