I am working on windows phone app and I want to delete item from listbox.
I am using following code List numbers=new List();
ObservableCollection<string> myCollection = new ObservableCollection<string>(numbers);
int indexPerson = listBox1.SelectedIndex;
myCollection.RemoveAt(indexPerson);
var my = (ObservableCollection<string>)listBox1.ItemsSource;
listBox1.ItemsSource=my;
and when I click on delete button one item is deleted based on index and then when I will delete another item the previously deleted item is show and current deleted item is deleted.
How can I delete all items?
See Question&Answers more detail:os