Create a ViewModel for each item of your list. In your example: vm.MySelectedItems. Add(thisItem) let's assume thisItem is of type ListBoxItemViewModel .
This type should have a property called IsChecked and then in Xaml.
Up vote 1 down vote favorite share g+ share fb share tw.
I'm trying to figure out a way to bind my CheckBox IsChecked property. Basically, I have a list of items which the ListBox is bound to. When a user checks the box, a command is invoked and that item is added to a collection.
However, what if I want to programmatically select items in the list? I would like the IsChecked item to be based on whether or not the item exists in a list in the ViewModel. In other words, if in my viewmodel, I do something like vm.MySelectedItems.
Add(thisItem), I would like the CheckBox to be Checked. Is this possible and if so, how should I go about it? Thank you.
Wpf data-binding mvvm checkbox listbox link|improve this question edited Sep 24 '11 at 17:50Dave Clemmer1,78331030 asked Feb 18 '10 at 13:13billb1,689718 72% accept rate.
Create a ViewModel for each item of your list. In your example: vm.MySelectedItems. Add(thisItem) let's assume thisItem is of type ListBoxItemViewModel.
This type should have a property called IsChecked, and then in Xaml Hope I got your question properly :). Cheers.
Thanks Anvaka, I thought of that as well, but felt there had to be a better way. If that's the best way, I'm happy to do it. Thank you for the response.
– billb Feb 18 '10 at 13:45 I went with this approach, thanks for the answer! – billb Feb 18 '10 at 16:04 Glad I could help :)! – Anvaka Feb 18 '10 at 16:11.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.