private void DeleteQuestion_Click(object sender, RoutedEventArgs e) { if (listBox.SelectedItem != null) { _contentManager.DeleteQuestion((listBox.SelectedItem as Question).ID, _selectedQuiz); questions.Remove(listBox.SelectedItem as Question); EditQuestion.IsEnabled = false; DeleteQuestion.IsEnabled = false; _saved = false; Save.IsEnabled = true; } }