I have a collection of categories, and each category contains a list of items. I'm binding it to a RadTreeView and want the tree to be editable by the user. I successfully bound the collection to the tree, however I'm I can't figure out how to have one data template for the editing of category, and another for editing of an item (child). (the hierarchy is only 2 deep)
How can I have separate data templates for Editing?
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"ChildItemTemplate"
>
<
TextBlock
Text
=
"{Binding ItemName, Mode=TwoWay}"
FontSize
=
"9"
Width
=
"130"
/>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"CategoryEditTemplate"
>
<
TextBox
Text
=
"{Binding CategoryName, Mode=TwoWay}"
FontSize
=
"9"
Width
=
"130"
/>
</
DataTemplate
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"TreeDataTemplate"
ItemsSource
=
"{Binding ChildItems}"
ItemTemplate
=
"{StaticResource ChildItemTemplate}"
>
<
TextBlock
Text
=
"{Binding CategoryName}"
FontSize
=
"9"
/>
</
telerik:HierarchicalDataTemplate
>
</
UserControl.Resources
>
<
telerik:RadTreeView
ItemsSource
=
"{Binding Categories}"
ItemTemplate
=
"{StaticResource TreeDataTemplate}"
ItemEditTemplate
=
"{StaticResource CategoryEditTemplate}"
/>