private void btnBuscar_Click(object sender, RoutedEventArgs e) { BLLAutoTexto bllAutoTexto = new BLLAutoTexto(); string filtro = ""; string valor = txtboxPesquisa.Text; if (bool.Parse(radioButtonCodigo.IsChecked.ToString())) { int value = 0; int.TryParse(valor, out value); valor = value.ToString(); filtro = "id"; } if (bool.Parse(radioButtonTexto.IsChecked.ToString())) { filtro = "texto"; } dataGridMed.ItemsSource = bllAutoTexto.SelectAdvanced(filtro, valor); }