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

Setting the SelectedItem doesn't expand the tree

1 Answer 101 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Architecture Board
Top achievements
Rank 1
Architecture Board asked on 31 Aug 2010, 12:31 PM
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;
  }
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 02 Sep 2010, 11:25 AM
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
Tags
TreeListView
Asked by
Architecture Board
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Share this question
or