private bool DeleteSelected() { int count = currentDataGrid.SelectedItems.Count; bool res = false; MessageBoxResult result = MessageBoxResult.None; //Showing confirmation window only if selected items > 1 if (count > 1) { result = MessageBox.Show( $"About to delete {count} selected rows.\n\nProceed?", "Delete selection", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); } if (result != MessageBoxResult.No) { //Delete selected items from the table var items = currentDataGrid.SelectedItems; CurrentTable.MultipleDelete(items); res = true; } //Enabling Delete, Update &Select buttons in case the current table is not empty SetButtonsActivation(CurrentTable.Count > 0); SetRowCount(); return(res); }
private void deleteBtn_Click(object sender, RoutedEventArgs e) { DeleteWindow deleteWindow = new DeleteWindow(CurrentTable); if (deleteWindow.ShowDialog() == true) { CurrentTable.MultipleDelete(deleteWindow.ResultDB); //Enabling Delete, Update &Select buttons in case the current table is not empty SetButtonsActivation(CurrentTable.Count > 0); SetRowCount(); RefreshGrid(); } }