This project has moved and is read-only. For the latest updates, please go here.

Bind CheckListBox to ObservableCollection

May 5, 2013 at 2:08 PM
Hi,

I have a 2 properties
ObservableCollection<User>ProjectUsers
ObservableCollection<User>ChosenProjectUsers

I put in a window a CheckListBox that shows all the ProjectUsers.
I want ChosenProjectUsers to hold the selecteditems of ProjectUsers.
And that when I open again the window with the CheckListBox I will see the selected items already checked.

How can I do it smartly ?
Thanks.
May 6, 2013 at 2:21 PM
bind "ProjectUsers" to the "ItemsSource" property
Bind the "ChosenProjectusers" to the "SelectedItemsOverride" property.
May 7, 2013 at 9:40 AM
Edited May 7, 2013 at 9:42 AM
Hi,

Thanks. I did it and it works.
But I have two problems now:
  1. Idefined an Checklistbox.Itemtemplate in version 1.9 and when I opened the application I saw the object itself. Seems that the itemtemplate is not working in version 1.9. I downgraded to version 1.8 and it works.
  2. When I check some checkboxes in the checklistbox inside a window, close the window and open again, the checkboxes are chosen. But when I save the ChosenUsers to xml, close the application, open again, reading the ChosenUsers from the xml and open the window, the checkboxes are not checked. I can see in debug that selecteditems property shows the two objects I have chosen, but the control does not show them
Are these two problems are known issue ?
How can I solve number 2 ?

Thanks