wrap treeview node text

2 posts, 1 answers
  1. Kevin
    Kevin avatar
    24 posts
    Member since:
    Apr 2011

    Posted 14 Dec 2011 Link to this post


    I have a treeview in a stackpanel which can expand or shrink base on some logic. is it possible to limited the maxlenght of the treeview node text so that the text will wrap instread of the horizontal scrollbar shows up when the text is longer than the initial length of the treeview?


  2. Answer
    Petar Mladenov
    Petar Mladenov avatar
    3162 posts

    Posted 19 Dec 2011 Link to this post

    Hello Kevin,

     You can set MaxWidth of the RadTreeViewitems via Style and then you can use TextBlocks for the Headers. You need to set the TextWrapping property of the TextBlocks to "Wrap", for  example like so:

    <Grid x:Name="LayoutRoot" Background="White">
                <Style TargetType="telerik:RadTreeViewItem">
                    <Setter Property="MaxWidth" Value="290" />
                <DataTemplate x:Key="itemtemplate">
                    <TextBlock TextWrapping="Wrap" Text="{Binding Name}" />
            <telerik:RadTreeView x:Name="tree" ItemTemplate="{StaticResource itemtemplate}" Width="300" Background="AliceBlue"/>
    You can find this realized in the attached project. Please let us know if it satisfies you. Regards,
    Petar Mladenov
    the Telerik team

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

Back to Top