Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > TreeView > wrap treeview node text

Answered wrap treeview node text

Feed from this thread
  • Kevin avatar

    Posted on Dec 14, 2011 (permalink)

    hi

    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?

    Thanks

    Kevin

    Reply

  • Answer Petar Mladenov Petar Mladenov admin's avatar

    Posted on Dec 19, 2011 (permalink)

    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">
            <Grid.Resources>
                <Style TargetType="telerik:RadTreeViewItem">
                    <Setter Property="MaxWidth" Value="290" />
                </Style>
                <DataTemplate x:Key="itemtemplate">
                    <TextBlock TextWrapping="Wrap" Text="{Binding Name}" />
                </DataTemplate>
            </Grid.Resources>
     
            <telerik:RadTreeView x:Name="tree" ItemTemplate="{StaticResource itemtemplate}" Width="300" Background="AliceBlue"/>
     
        </Grid>
    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 >>

    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > TreeView > wrap treeview node text
Related resources for "wrap treeview node text"

Silverlight TreeView Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]