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

Localizing treeview node elements text

1 Answer 86 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Vladislav
Top achievements
Rank 1
Vladislav asked on 01 Sep 2016, 03:11 PM
Hello, can you please tell me how to properly localize radtreeview nodes text? The localization is working properly for other controls like rad menu items: In case of them, I only had to change the language property in parent RadForm, and set text property in particular language for that control and it worked fine. However, it cannot be done for tree nodes. For tree nodes I tried changing the language property in the parent form then opening the property builder where I set Text property. It turns out that the text set in this property is the text that is shown in all languages, not just in the one selected in the main form. So, how to do this?
Joachim
Top achievements
Rank 1
commented on 11 Sep 2024, 01:53 PM

The property RadTreeNode.Text is not marked as [Localizable(true)], so the designer doesn't put it in a .resx file. This is a bug that should be fixed.

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 16 Sep 2024, 10:56 AM

Hello, Vladislav,

In order to set custom text for the tree nodes in RadTreeView you should handle the NodeFormatting event. This event triggers for every NodeElement and you can customize its ContentElement.Text to any text or language that you need. Please refer to the following example:

this.radTreeView1.NodeFormatting += RadTreeView1_NodeFormatting;

private void RadTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
{
    e.NodeElement.ContentElement.Text = "My node text here";
}

@Joachim, note that RadTreeView uses UI virtualization for its nodes, and if you want to customize them the suitable place is NodeFormatting event. This is the mechanism that we provide for customizing nodes appearance when using virtualization. Hence, this is not a bug. More information is available here: Formatting Nodes - RadTreeView - Telerik UI for WinForms

I hope this information helps. If you have other questions, please let me know.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Treeview
Asked by
Vladislav
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or