private void RemoveSelectedItem(object obj) { for (int i = SelectedItemsInListBox.Count; i-- > 0;) { ItemViewModel item = SelectedItemsInListBox[i]; if (item.IsSelected) { SelectedItemsInListBox.RemoveAt(i); } } }
public void RemoveClickedItem(object obj) { System.Windows.Controls.TextBlock itemTextBlock = obj as System.Windows.Controls.TextBlock; if (itemTextBlock == null) { return; } foreach (KeyValuePair <int, string> item in AvailableItemList) { if (item.ToString() == itemTextBlock.Text) { SelectedItemsInListBox.RemoveAt(item.Key); } } }