Hi! can anyone help me with this.
I am using a treeview for silverlight and i want to bind the subnode into a list of string List<String>.
<
UserControl.Resources>
<ds:RenderData x:Key="Data"/>
<telerik:HierarchicalDataTemplate x:Key="Node" ItemsSource="{Binding SubNode}">
<TextBlock Text="{Binding Name}"/>
</telerik:HierarchicalDataTemplate>
<telerik:HierarchicalDataTemplate x:Key="Node" ItemsSource="{Binding SubNode}">
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<telerikNavigation:RadTreeView ItemsSource="{Binding Source={StaticResource Data}}"
ItemTemplate="{StaticResource Node}">
<TextBlock Text="{Binding SubNode}"/>
</telerikNavigation:RadTreeView>
</Grid>
public
class Node
{
public Node(String NodeName)
{
Name = NodeName;
SubNode =
new List<String>();
}
public string Name
{
get;
set;
}
public List<String> SubNode
{
get;
set;
}
}
public class RenderData : List<Node>
{
public RenderData()
{
Node tmpChild;
Add(tmpChild =
new Node("A"));
tmpChild.SubNode.Add(
"A.1");
tmpChild.SubNode.Add(
"A.2");
Add(tmpChild =
new Node("B"));
tmpChild.SubNode.Add(
"B.1");
tmpChild.SubNode.Add(
"B.2");
Add(tmpChild =
new Node("C"));
tmpChild.SubNode.Add(
"C.1");
tmpChild.SubNode.Add(
"C.2");
Add(tmpChild =
new Node("D"));
tmpChild.SubNode.Add(
"D.1");
tmpChild.SubNode.Add(
"D.2");
Add(tmpChild =
new Node("E"));
tmpChild.SubNode.Add(
"E.1");
tmpChild.SubNode.Add(
"E.2");
Add(tmpChild =
new Node("F"));
tmpChild.SubNode.Add(
"F.1");
tmpChild.SubNode.Add(
"F.2");
Add(tmpChild =
new Node("G"));
tmpChild.SubNode.Add(
"G.1");
tmpChild.SubNode.Add(
"G.2");
Add(tmpChild =
new Node("H"));
tmpChild.SubNode.Add(
"H.1");
tmpChild.SubNode.Add(
"H.2");
}
}
base on the samples that i have seen, they are all bind in a list of objects List<well> or List<Person>.
HOw do you bind a List<String>?
Thanks.