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

SelectedItem Bindable in MVVM

5 Answers 387 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Andrea Ferrari
Top achievements
Rank 1
Andrea Ferrari asked on 10 Jul 2010, 03:07 PM
Hi.
Just a question: The SelectedItem is not bindable to a property in the ViewModel on a MVVM pattern?

If not, how to get the selectedItem in the ViewModel?
I need becouse I've to manage the add and remove buttons.

Thanks and regards.

Andrea

5 Answers, 1 is accepted

Sort by
0
Ваня
Top achievements
Rank 1
answered on 11 Jul 2010, 10:00 AM
Hi,Andrea Ferrari

Please,see the following thread,I believe that it could be useful for you
http://social.msdn.microsoft.com/Forums/en/wpf/thread/d9439546-95bf-41b6-ad5c-62fa41f17cb3

Hope this helps!
0
Kiril Stanoev
Telerik team
answered on 15 Jul 2010, 12:44 PM
Hi Andrea,

There should be no problem binding the SelectedItem property of RadTreeView. The attached project demonstrates element binding between a ListBox and a TreeView. Also, I'd suggest you go through the link that Vanya previously posted.

Regards,
Kiril Stanoev
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
0
Adrian
Top achievements
Rank 1
answered on 23 Aug 2019, 06:56 AM

Hello,

 

I managed to delete the treeviewitem item (thanks to your post), but I wanted to create a DependencyProperty that should be using the ICommand and listen to the SelectedItemChanged event on the TreeView. How can I do this?

0
Adrian
Top achievements
Rank 1
answered on 23 Aug 2019, 06:58 AM

[quote]Ваня said:Hi,Andrea Ferrari

Please,see the following thread,I believe that it could be useful for you
http://social.msdn.microsoft.com/Forums/en/wpf/thread/essays.agency/thread/d9439546-95bf-41b6-ad5c-62fa41f17cb3

Hope this helps![/quote]

Hello,

I managed to delete the treeviewitem item (thanks to your post), but I wanted to create a DependencyProperty that should be using the ICommand and listen to the SelectedItemChanged event on the TreeView. How can I do this?

0
Martin Ivanov
Telerik team
answered on 23 Aug 2019, 10:31 AM

Hello Adrian,

To achieve your requirement you can use the EventToCommandBehavior. This will allow you to bind an ICommand to the SelectionChanged event of RadTreeView.

Regards, Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TreeView
Asked by
Andrea Ferrari
Top achievements
Rank 1
Answers by
Ваня
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Adrian
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or