When selecting my item "All", I set the SelectedValue property to every possible value ...
```
private string _selected;
public string Selected
{
get { return _selected; }
set
{
if (value.Contains(Constants.CRITERIA_ALL))
{
var cs = string.Join(",", MyArrayOfValues);
Set(() => Selected, ref _selected, cs);
return;
}
Set(() => Selected, ref _selected, value);
}
}
```
The checkboxes are not checked ...
Comments: ** Comment from web user: BoucherS **
Hi,
When clicking in a checkBox, the checkBox.SelectedItems property is updated. At this moment, the checkBox.SelectedValue is updated based on the checkBox.SelectedItems. If you try to modify the checkBox.SelectedValue property during this process, conflicts of updates can occur.
Try something like this instead :
```
private List<string> MyArrayOfValues = new List<string>() { "All", "Montreal", "New York", "Los Angeles", "Miami", "Vancouver" };
public MainWindow()
{
InitializeComponent();
_checkListBox.ItemsSource = MyArrayOfValues;
_checkListBox.ItemSelectionChanged += new Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventHandler( this.ItemSelectionChanged );
}
private void ItemSelectionChanged( object sender, Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e )
{
if( ( ( string )e.Item == "All") && e.IsSelected )
{
//Adjust the SelectedValue Property to all the strings
_checkListBox.SelectedValue = string.Join( ",", MyArrayOfValues );
}
else if( !e.IsSelected )
{
if( _checkListBox.SelectedValue.Contains("All") )
{
//Remove the "All" string from the SelectedValue Property
_checkListBox.SelectedValue =_checkListBox.SelectedValue.Remove( 0, 4 );
}
}
}
```