Setting the SelectedItem doesn't expand the tree

2 posts, 1 answers
  1. Standard IM
    Standard IM avatar
    1 posts
    Member since:
    Apr 2010

    Posted 31 Aug 2010 Link to this post

    We have bound the selected item to a property in the view model, but changing the selected item in the view model doesn't change the expanded (collapsed) tree nodes. On a callback handler we set the Nodes property and the SelectedNode property, the tree view list is bound correctly but what we are looking for is a way to expand the tree to show and focus the selected item. Is it possible?

    <RadTreeListView ItemsSource="{Binding Nodes}" SelectedItem="{Binding SelectedNode}" />

    public class ViewModel
    {
      //Properties raise property changed event
      public IEnumerable<Node> Nodes { get; set; }
      public Node SelectedNode { get; set; }
     
      private void LoadComplete(Response response)
      {
        this.Nodes = response.Nodes;
        this.SelectedNode = response.SelectedNode;
      }
    }
  2. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 02 Sep 2010 Link to this post

    Hello Claudia Lienert,

     Unfortunately, we are not able to implement this functionality inside the RadTreeListView, as it is very model-specific. Please find attached a solution that achieves this using ViewModels and custom code-behind.

    To test it, expand the RadTreeView to the right and select the inner-most node. The RadTreeListView to the left should expand and select the proper node.

    Greetings,
    Yavor Georgiev
    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. DevCraft banner
Back to Top