private void DeleteProperty_Click(object sender, RoutedEventArgs e) { if (PropertiesDataGrid.SelectedItems == null) { MessageBox.Show("Не было выбрано ни одного свойства", "Ошибка"); return; } var result = MessageBox.Show( $"Вы действительно хотите удалить ({PropertiesDataGrid.SelectedItems.Count}) свойств?", "Внимание", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (result == MessageBoxResult.Cancel || result == MessageBoxResult.No) { e.Handled = true; return; } foreach (var item in PropertiesDataGrid.SelectedItems) { int propertyId = _properties .First(p => p.Value == PropertiesDataGrid.Items.IndexOf(item)) .Key; _SQLClient.DeletePropertyFromConcepts(_selectedConceptId, propertyId); } SelectConceptProperties(_selectedConceptId); }