This is the ListBox code:
It would probably be best to bind the CheckBox
to the IsSelected
property of the ListBoxItem
, like so:
<DataTemplate>
<CheckBox Content="{Binding .}" IsChecked="{Binding RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" />
</DataTemplate>
Then you can get the checked/selected items from the ListBox.SelectedItems collection. You'd also have to set SelectionMode to Multiple.