Expandable node doesnt show text

2 posts, 0 answers
  1. ss
    ss avatar
    50 posts
    Member since:
    Jun 2010

    Posted 21 Jul 2010 Link to this post


    I have problem with TreeView. I have following code:

    <UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="AdministrationClient.Pages.SettingsManagerPage"
        d:DesignHeight="300" d:DesignWidth="400">
            <core:HierarchicalDataTemplate x:Key="SettingsTreeNodeTemplate" ItemsSource="{Binding Children}">
                        <TextBlock Text="{Binding Text}" TextWrapping="Wrap" Width="400"/>
        <Grid x:Name="LayoutRoot" Background="White">
                <RowDefinition Height="22" />
                <RowDefinition />
                <ColumnDefinition Width="500" />
                <ColumnDefinition />
            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.ColumnSpan="2" FlowDirection="RightToLeft">
                <telerik:RadButton Name="btnNewSettingsItem" Width="55" Height="22" Content="New" />
                <TextBox Text="{Binding Path=Name}"></TextBox>
                ItemsSource="{Binding SettingsTree}" 
                ItemTemplate="{StaticResource SettingsTreeNodeTemplate}">

    I dont know why but result of this code is TreeView which is shown in the following picture:

    Can you please tell my why expandable node doesnt show text?

    My Next question is how to show more than two levels? Just now, TreeView is able to show only 2 levels but I dont know number of levels. Is it possible?

    Thank you very much.




  2. Hristo
    Hristo avatar
    352 posts

    Posted 22 Jul 2010 Link to this post


    You need to include the <TextBlock Text="{Binding Text}" /> for the outer HierarchicalDataTemplate. This way you are going to define the template for the first tree level. By setting the ItemTemplate property you are defining template for the children (second level).

    I recommend you to take a look of the examples available at
    especially the
    http://demos.telerik.com/silverlight/#TreeView/HierarchicalTemplate .

    Regarding your second question you can see the following resource
    http://www.telerik.com/help/silverlight/radtreeview-templating-hierarchical-data-templates.html .

    Best wishes,
    Hristo Milyakov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top