Node Text Multiline

3 posts, 1 answers
  1. Matteo Fabris
    Matteo Fabris avatar
    4 posts
    Member since:
    Aug 2012

    Posted 27 May 2015 Link to this post

    Hello,

    How can I set Node Text Multiline?

    Is there any worktrought?

    thanks

  2. Answer
    Dess
    Admin
    Dess avatar
    1607 posts

    Posted 27 May 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Matteo Fabris
    Matteo Fabris avatar
    4 posts
    Member since:
    Aug 2012

    Posted 28 May 2015 in reply to Dess Link to this post

    Works Great!

    Thanks!

Back to Top