This question is locked. New answers and comments are not allowed.
If I have the following data structure
public class Level0
{
public class Level2
{
public string Level2Name { get; set; }
};
public class Level1
{
public string Level1Name { get; set; }
public List<Level2> Level2List;
public Level1()
{
Level2List = new List<Level2>();
}
};
public string Level0Name { get; set; }
public List<Level1> Level1List;
public Level0()
{
Level1List = new List<Level1>();
}
}
And I want to define a HierarchicalDataTemplate for use in a RadTreeListView in silverlight 3. I tried the following:
<telerik:HierarchicalDataTemplate
x:Key="Level2Template" >
<TextBlock Foreground="Yellow" Text="{Binding Level2name}"></TextBlock>
</telerik:HierarchicalDataTemplate>
<telerik:HierarchicalDataTemplate
x:Key="Level1Template"
ItemTemplate="{StaticResource Level2Template}"
ItemsSource="{Binding Level2List}" >
<TextBlock Foreground="Blue" Text="{Binding Level1Name}"></TextBlock>
</telerik:HierarchicalDataTemplate>
<telerik:HierarchicalDataTemplate
x:Key="Level0Template"
ItemTemplate="{StaticResource Level1Template}"
ItemsSource="{Binding Level1List}" >
<TextBlock Foreground="Red" Text="{Binding Level0Name}"></TextBlock>
</telerik:HierarchicalDataTemplate>
then the RadTreeListView
<telerikNavigation:RadTreeListView
x:Name="TheTree"
ItemTemplate="{StaticResource Level0Template}" >
<telerikNavigation:RadTreeListView.Columns>
<telerikNavigation:RadColumn Header="Hierarchy" />
</telerikNavigation:RadTreeListView.Columns>
</telerikNavigation:RadTreeListView>
I tried numerous variations on this and nothing seems to work to display the tree listview.
Can someone show me where the problem is or suggest better way. I cant use Silveright 4 yet in this project.
gkelly
public class Level0
{
public class Level2
{
public string Level2Name { get; set; }
};
public class Level1
{
public string Level1Name { get; set; }
public List<Level2> Level2List;
public Level1()
{
Level2List = new List<Level2>();
}
};
public string Level0Name { get; set; }
public List<Level1> Level1List;
public Level0()
{
Level1List = new List<Level1>();
}
}
<telerik:HierarchicalDataTemplate
x:Key="Level2Template" >
<TextBlock Foreground="Yellow" Text="{Binding Level2name}"></TextBlock>
</telerik:HierarchicalDataTemplate>
<telerik:HierarchicalDataTemplate
x:Key="Level1Template"
ItemTemplate="{StaticResource Level2Template}"
ItemsSource="{Binding Level2List}" >
<TextBlock Foreground="Blue" Text="{Binding Level1Name}"></TextBlock>
</telerik:HierarchicalDataTemplate>
<telerik:HierarchicalDataTemplate
x:Key="Level0Template"
ItemTemplate="{StaticResource Level1Template}"
ItemsSource="{Binding Level1List}" >
<TextBlock Foreground="Red" Text="{Binding Level0Name}"></TextBlock>
</telerik:HierarchicalDataTemplate>
<telerikNavigation:RadTreeListView
x:Name="TheTree"
ItemTemplate="{StaticResource Level0Template}" >
<telerikNavigation:RadTreeListView.Columns>
<telerikNavigation:RadColumn Header="Hierarchy" />
</telerikNavigation:RadTreeListView.Columns>
Can someone show me where the problem is or suggest better way. I cant use Silveright 4 yet in this project.
gkelly