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

How to bind the SelectedItems of a ListView to a ViewModel?

1 Answer 210 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
fbaptiste
Top achievements
Rank 1
fbaptiste asked on 27 Jan 2015, 12:28 AM
I am using the following List view MVVM sample as the base for my code, but am trying to combine it with the selection feature of the ListView. 

One thing i could not achieve is the binding of the SelectedItems to an array in the ViewModel. i could kind of "hack" through this programmatically via the change event, but that's not enough for scenarios where i'd like certain items to be selected on loading of the widget. so i'm looking for a "right" way to this and to bind the selected items of the listview to a view model.

Can you provide an example for doing this?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 28 Jan 2015, 04:26 PM
Hello,

The functionality that you are looking for is not supported out of the box by the ListView/MVVM components.
It is possible to achieve it but you will have to write custom binding that will handle the selection of the values and the update of the ViewModel. This help article explains how to create a custom Kendo MVVM binding:
I hope this information will help.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MVVM
Asked by
fbaptiste
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or