1

I have a treeview with several items in it. How do I force the treeView to select a specific item ? Everytime I try to use any of the "Selected..." property, I get the error that it is read-only and cannot be set either in code or in XAML.

Regards,

David Brunelle
  • 6,528
  • 11
  • 64
  • 104

1 Answers1

2

You need to create a Selected property on your tree item's ViewModel, and bind to it.

Here is an article that explains how to do it.

Edit. Actually that uses a different way. The article I was thinking of was this one

GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
  • I did find my problem and it wasn't that (I knew about this and though there was something missing, but it was just a reference issue). Just to mention, I use "IsSelected" in my case but I believe you could make it work with "Selected" too. – David Brunelle Feb 07 '12 at 16:51