private void DeleteWork_Click(object sender, RoutedEventArgs e) { try { workRepository.DeleteWork(WorkToDelete.SelectedItem.ToString()); } catch (NullReferenceException) { MessageBox.Show("There is no WorkId selected", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }