TreeNode contructors

5 posts, 0 answers
  1. Maxime
    Maxime avatar
    12 posts
    Member since:
    Aug 2008

    Posted 27 Feb 2010 Link to this post

    Hi,

    I was just wondering if there was any reason there are no overrides when instantiating a RadTreeNode to set BOTH the TEXT value AND Name Value of the node?

    So lets say I wanna create a array of RadTreeNode from some data I have, since there just a constructor having the text (and others but still no NAME property) I have to loop through them to set one by one their name value...


    Thanks :)
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 01 Mar 2010 Link to this post

    Hello Maxime,

    Thank you for writing. I suggest you do not use the Name property at all since we are considering deprecating it. If you need to keep some custom information in the node I suggest using the Tag property. If the Tag property is not appropriate for some reason I suggest inheriting from RadTreeNode and declaring your own property. Please write again if you have other questions.

    Regards,
    Victor
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Maxime
    Maxime avatar
    12 posts
    Member since:
    Aug 2008

    Posted 01 Mar 2010 Link to this post

    Hi,

    Thanks for your answer.

    So if I bind data to the treeview, there's no way for me to have an ID and a TEXT value juste like a dropdown per say?
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 02 Mar 2010 Link to this post

    Hello Maxime,

    Thank you for writing. When you are using data binding there is little control over the creation of nodes. However, you have a Text (indicated by DisplayMember) property and a value which corresponds to the ValueMember property will be stored in the Tag of each RadTreeNode. Here is a small comparison of how RadListBox and how RadTreeView binds to data:

    RadListBox:

    radListBox.DisplayMember = "Name";
    radListBox.ValueMember = "Id";
    radListBox.DataSource = dataSource;
     
    // Values are retrieved like so:
    object value = (radListBox.SelectedItem as RadListBoxItem).DataBoundItem;

    RadTreeView:

    radTreeView.DisplayMember = "Name";
    radTreeView.ValueMember = "Id";
    radTreeView.DataSource = dataSource;
     
    object value = radTreeView.SelectedNode.Tag;

    Write again if you have other questions.

    Best wishes,
    Victor
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Mar 2011 Link to this post

    Hi Maxime,

    Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release refer to this blog post

    Greetings,
    Stefan
    the Telerik team
Back to Top
UI for WinForms is Visual Studio 2017 Ready