You have explained a little, I hope you do it in a WPF way ...
Create a property IsSelectedin your data elements, then specify a style for yours ListBoxItemthat will select them when enabled IsSelected:
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding IsSelected}"/>
</Style>
</ListBox.ItemContainerStyle>
Then change the property on your data items and raise the event OnPropertyChanged.
source
share