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

CheckListBox : SelectedValue not updated on SelectedItems.Add/Remove

Developer
Mar 7, 2016 at 12:25 PM
A user wrote :
"If i add item to SelectedItems by use SelectedItems.Add(object) , the ItemSelectionChanged event raise , this is fine but when i check SelectedValue i do not find the value of this object.

This also apply when i remove an item SelectedItems.Remove(object)"
Developer
Mar 7, 2016 at 12:26 PM
I cannot reproduce the bug. Can you submit a sample ?
Here's one that works :
 <StackPanel>
        <xctk:CheckListBox x:Name="_checkListBox"/>
       <TextBlock Text="{Binding SelectedValue, ElementName=_checkListBox}"/>
       <Button Content="ADD" Click="Button_Click"/>
    </StackPanel>
 public MainWindow()
    {
      InitializeComponent();

      _checkListBox.ItemsSource = new ObservableCollection<string>()
      {
         "Price",
        "Subban",
        "Galchenyuk",
      };
    }

    private void Button_Click( object sender, RoutedEventArgs e )
    {
      _checkListBox.SelectedItems.Add( "Subban" );
    }