ListBoxItem selectedItem = (ListBoxItem)myListBox.SelectedItem; selectedItem.SetValue(ContentProperty, "New Content");
ListBoxItem selectedItem = (ListBoxItem)myListBox.SelectedItem; selectedItem.SetValue(BackgroundProperty, Brushes.Green);This code sets the background color of the selected item in myListBox to green. These examples use the System.Windows.Controls namespace, which is part of the WindowsBase library.