private void RemoveAllBtn_OnClick(object sender, MouseButtonEventArgs e) { var result = MessageBox.Show("Deseja remover TODOS os dados?", "Remoção", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { removeAllBtn.Background = Brushes.Red; var selectedType = dataGrid.SelectedItem.GetType().Name; if (selectedType == bUser.GetType().Name) { bUser.Clear(); UsersBtn_OnClick(sender, e); } else if (selectedType == bAccs.GetType().Name) { bAccs.Clear(); AccsLogBtn_OnClick(sender, e); } } RemoveAllBtn_NonClick(sender, e); }