First of all I am sorry for my language grammar because my first language is Persian (Iran). I have a ComboBox which has CheckBox for multi selection and multi deletion then i tried to following codes but i did not reach a conclusion.

<Style x:Key="{x:Type ComboBoxItem}" TargetType="{x:Type ComboBoxItem}">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<Border x:Name="Border" SnapsToDevicePixels="true" Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0" Value="#FFC5CBF9" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedUnfocused">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0" Value="#FFDDDDDD" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<CheckBox Name="MultiSelectCheckBox" Content="{Binding}" Checked="MultiSelectCheckBox_Checked">
</CheckBox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Code behind:
List<string> CheckedList = new List<string>();
private void MultiSelectCheckBox_Checked(object sender, RoutedEventArgs e)
{
CheckBox CB = sender as CheckBox;
CheckedList.Add(CB.Content.ToString());
}
private void Delete_Button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
switch (BookCategory_ComboBox.Text)
{
case null:
break;
default:
for (int i = 0; i < CheckedList.Count - 1; i++)
{
string a = CheckedList[i].ToString();
if (CheckedList[i].ToString()==BookCategory_ComboBox.Items[i].ToString())
{
BookCategory_ComboBox.Items.Remove(BookCategory_ComboBox.Items[i]);
}
}
break;
}
}
Thanks

