private void dtg_rec_SelectionChanged(object sender, SelectionChangedEventArgs e) { int id_plato = 0; try { PlatoBLL ub = new PlatoBLL(); DataGrid gd = (DataGrid)sender; DataRowView drv = gd.SelectedItem as DataRowView; if (drv != null) { id_plato = int.Parse(drv["ID"].ToString()); } DataTable dte = new DataTable(); dte = ub.platoRela(id_plato); dtg_rece_list.ItemsSource = dte.DefaultView; dtg_rece_list.Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show("" + ex); } }