I'm trying to display a list of items and their children in a TreeListView.
The children are not the same type as parent items, so I looked into useing a HierarchicalDataTemplate, but I can't get it to work.
I did a little digging and saw some posts that said TreeListView does not support parent child relationships of different types, but then saw another post where someone had defined one, but I can't get it to work. (http://www.telerik.com/community/forums/silverlight/treelist/silverlight-3-radtreelistview-hierarchicaldatatemplate-question.aspx)
Does it or doesn't support HierarchicalDataTemplate?
What I have is this:
public
class
Parent
{
public
string
Name {
get
;
set
;}
public
List<Child> Items {
get
;
set
; }
}
public
class
Child
{
public
string
ItemRTF {
get
;
set
; }
}
<
UserControl.Resources
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"ChildTemplate"
>
<
telerik:RadRichTextBox
Background
=
"Yellow"
IsReadOnly
=
"true"
/>
</
telerik:HierarchicalDataTemplate
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"ParentTemplate"
ItemTemplate
=
"{StaticResource ChildTemplate}"
ItemsSource
=
"{Binding Items}"
>
<
sdk:Label
Background
=
"Green"
Content
=
"{Binding Name}"
/>
</
telerik:HierarchicalDataTemplate
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadTreeListView
Margin
=
"12,12,12,37"
Name
=
"myTreeListView"
ItemTemplate
=
"{StaticResource ParentTemplate}"
AutoGenerateColumns
=
"False"
>
<
telerik:RadTreeListView.Columns
>
<
telerik:GridViewColumn
Width
=
"*"
/>
</
telerik:RadTreeListView.Columns
>
</
telerik:RadTreeListView
>
</
Grid
>