I am trying to change background-color of selected item of a listbox. it changes background-color but next time if I select another item, then background-color of previous selected item should set to null or default.
Listbox name is lstContacts.
private void lstContacts_SelectionChanged(object sender, SelectionChangedEventArgs e)
lstContacts.ClearValue(ListBox.BackgroundProperty);//its not working
ListBoxItem item = lstContacts.ItemContainer.ContainerFromItem(lstContacts.SelectedItem) as ListBoxItem;
item.Background = new SolidColorBrush(Colors.Red);
can anyone help me?