Working with Treeview child node - get a selected item

2 posts, 0 answers
  1. Charles
    Charles avatar
    10 posts
    Member since:
    Dec 2011

    Posted 08 Apr 2014 Link to this post

    How to get a selected item of a child treeview programmatically 
  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 09 Apr 2014 Link to this post

    Hi Charles,

    You can get the selected item of a RadTreeView with its SelectedItem property.

    However, you can keep in mind that the containers of the children of a RadTreeView are generated when they are expanded for the first time. If the selected item is in lower level in the tree hierarchy and has not been expanded yet, the SelectedItem property will return Null. This is caused by the fact that the selected RadTreeViewItem is not generated.

    In order to get a selected item which has not been expanded yet (therefore is not generated) you can use the GetItemByPath() method. For your convenience I attached a sample project which demonstrates the use of this method.

    Please let me know if you need any further assistance.

    Regards,
    Martin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top