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

RadDataBoundListBox clear all checked items in viewmodel

2 Answers 37 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Daniele
Top achievements
Rank 1
Daniele asked on 14 Jul 2015, 01:48 PM

Hi,

I would like to clear all checked items in the viewmodel?

Is it possible?

 

I know that in the code behind I can use this code:

 

MyList..CheckedItems.Clear();

 

But since I would like to follow the mvvm pattern I would do it in the ViewModel of the page?

 

Thanks in advanced.

Daniele

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 17 Jul 2015, 10:43 AM
Hello Daniele, 

You can achieve the described requirements by creating custom boolean attached property. Once you create it you will be able to bind it to a property from your ViewModel. This will allow you to trigger it from your ViewModel. On the other hand, in the PropertyChanged callback of the attached property you will be able to clear the CheckedItems collection using the DependencyObject argument.

In addition to this the RadDataBoundListBox control exposes ItemCheckedStateChanged event. You can subscribe to it and you will be able to set back the property of your view model to its initial state when the event is invoked.

I believe this will get you started. Do not hesitate to contact us again if you need any further assistance.

Regards,
Pavel R. Pavlov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Daniele
Top achievements
Rank 1
answered on 18 Jul 2015, 01:50 PM

Thanks Pavel,

by an attached property I could achieve my target.

 

Thanks

Daniele

Tags
DataBoundListBox
Asked by
Daniele
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Daniele
Top achievements
Rank 1
Share this question
or