This is a migrated thread and some comments may be shown as answers.

Node Text Multiline

2 Answers 200 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Matteo Fabris
Top achievements
Rank 2
Matteo Fabris asked on 27 May 2015, 09:37 AM

Hello,

How can I set Node Text Multiline?

Is there any worktrought?

thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 May 2015, 11:31 AM
Hello Matteo,

Thank you for writing.

In order to show multiline text in RadTreeNodes you can increase the RadTreeNode.ItemHeight property. Thus, you will display the entire text. It is important to set the RadTreeView.AllowArbitraryItemHeight property to true as well:
public Form1()
{
    InitializeComponent();
 
    this.radTreeView1.AllowArbitraryItemHeight = true;
    StringBuilder sb;
    for (int i = 0; i < 10; i++)
    {
        RadTreeNode node = new RadTreeNode();
        sb = new StringBuilder();
        this.radTreeView1.Nodes.Add(node);
        for (int j = 0; j < i + 1; j++)
        {
            sb.AppendLine(i + ".Line" + j);
        }
        node.Text = sb.ToString();
        node.ItemHeight = TextRenderer.MeasureText(node.Text, node.Font).Height;
    }
}

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Matteo Fabris
Top achievements
Rank 2
answered on 28 May 2015, 01:51 PM

Works Great!

Thanks!

Tags
Treeview
Asked by
Matteo Fabris
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Matteo Fabris
Top achievements
Rank 2
Share this question
or