Hello,
I have created a treeview with multiple HierarchicalDataTemplateas below:
I wanted to apply filter on key press, but the treeview itemsource contains recursive dataset
Is this the right way to create a treeview with various number of treeviewitems and branches
Also I want to give treeviewitem fontcolor looking at different types of items
thanks,
nitin
I have created a treeview with multiple HierarchicalDataTemplateas below:
<
telerik:HierarchicalDataTemplate
x:Key
=
"TrendsTVTagsChildrenTemplate"
ItemTemplate
=
"{StaticResource TVItemTemplate}"
ItemsSource
=
"{Binding TvItem}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
ContentControl
ContentTemplate
=
"{Binding Type,Converter={StaticResource TrendsIconConverter}}"
></
ContentControl
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Text
=
"["
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding TvItem.Count}"
/>
<
TextBlock
Text
=
"]"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"TagsTemplate"
ItemTemplate
=
"{StaticResource TrendsTVTagsChildrenTemplate}"
ItemsSource
=
"{Binding TrendsTVTagsChildren}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
ContentControl
ContentTemplate
=
"{Binding Type,Converter={StaticResource TrendsIconConverter}}"
></
ContentControl
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Text
=
"["
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding TrendsTVTagsChildren.Count}"
/>
<
TextBlock
Text
=
"]"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"UPSTemplate"
ItemTemplate
=
"{StaticResource TagsTemplate}"
ItemsSource
=
"{Binding Tags}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
ContentControl
ContentTemplate
=
"{Binding Type,Converter={StaticResource TrendsIconConverter}}"
></
ContentControl
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Text
=
"["
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding Tags.Count}"
/>
<
TextBlock
Text
=
"]"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"IceboxTemplate"
ItemTemplate
=
"{StaticResource UPSTemplate}"
ItemsSource
=
"{Binding UPS}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
ContentControl
ContentTemplate
=
"{Binding Type,Converter={StaticResource TrendsIconConverter}}"
></
ContentControl
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Text
=
"["
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding UPS.Count}"
/>
<
TextBlock
Text
=
"]"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"ZonesTemplate"
ItemTemplate
=
"{StaticResource IceboxTemplate}"
ItemsSource
=
"{Binding Icebox}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
ContentControl
ContentTemplate
=
"{Binding Type,Converter={StaticResource TrendsIconConverter}}"
></
ContentControl
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Text
=
"["
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding Icebox.Count}"
/>
<
TextBlock
Text
=
"]"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"PlantTemplate"
ItemTemplate
=
"{StaticResource ZonesTemplate}"
ItemsSource
=
"{Binding Zones}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
ContentControl
ContentTemplate
=
"{Binding Type,Converter={StaticResource TrendsIconConverter}}"
></
ContentControl
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Text
=
"["
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding Zones.Count}"
/>
<
TextBlock
Text
=
"]"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
Is this the right way to create a treeview with various number of treeviewitems and branches
Also I want to give treeviewitem fontcolor looking at different types of items
thanks,
nitin