This is a migrated thread and some comments may be shown as answers.
TreeViewItem height
2 Answers 29 Views
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 09 Aug 2011, 02:47 PM
Hello. How can i ovverride radtreeview item height?
<Style x:Key="RadItemStyle" TargetType="telerik:RadTreeViewItem">
    <Setter Property="MinHeight" Value="10"/>
</Style>
 
<telerik:HierarchicalDataTemplate x:Name="ItemTemplate" ItemsSource="{Binding Converter={StaticResource HierarchyConverter}}">
    <telerik:RadTreeViewItem Header="{Binding Name}" Style="{StaticResource RadItemStyle}"/>
</telerik:HierarchicalDataTemplate>

this code doesn't work. :(

Thank's.

2 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 12 Aug 2011, 12:52 PM
Hello Alexandre,

When you define the RadTreeView.ItemTemplate you define the way the business data will be displayed inside the RadTreeViewItems. Basically when you bind the RadTreeView control to a business collection, the control's ItemsSource collection is populated and it is used to create RadTreeViewItem containers for each business item from the ItemsSource. So when you set an ItemTemplate it will control the way the business object inside the RadTreeViewItem container is displayed. However, in your case you define a RadTreeViewItem to display the business data, which means that the structure of your tree in any level will contain a RadTreeViewItem inside which a RadTreeViewItem is created to display the business object.

This is why I wanted to ask you to try this instead:
<UserControl.Resources>
    <Style x:Key="RadItemStyle" TargetType="telerik:RadTreeViewItem">
        <Setter Property="MinHeight" Value="10" />
    </Style>
 
    <telerik:HierarchicalDataTemplate x:Name="ItemTemplate"
            ItemsSource="{Binding Converter={StaticResource HierarchyConverter}}">
        <TextBlock Text="{Binding Name}"/>
    </telerik:HierarchicalDataTemplate>
</UserControl.Resources>
<telerik:RadTreeView ItemTemplate="{StaticResource ItemTemplate}"
        ItemContainerStyle="{StaticResource RadItemStyle}">
</telerik:RadTreeView>
Let me know if this works for you.

Greetings,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Alexandre
Top achievements
Rank 1
answered on 17 Aug 2011, 12:20 PM
that helps. thanks
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Alexandre
Top achievements
Rank 1
Share this question
or