This project has moved. For the latest updates, please go here.

CheckComboBox Binding Data

Jan 21, 2014 at 6:18 PM
Please post a code snippet on how to bind data to this checkedcomb box. I find it difficult to understand how to pass two data valus, one containing the total Items and the other containing selected items of these.

I tried the following and it worked but I just want to bind a single data source.
  1. I set
  2. I added the items to be selected to the SelectedItems property using a foreach loop. And these items are also added in the
    foreach(string str in LstSelectedItems)
But there should be a better option right??
Jan 21, 2014 at 6:28 PM

Here's a solution :
List<string> listOfItems = new List<string>() { "abc", "def", "ghi", "jkl" };
List<string> selectedItems = new List<string>() { listOfItems[0], listOfItems[2] };
_checkComboBox.ItemsSource = listOfItems;
 _checkComboBox.SelectedItemsOverride = selectedItems;