private void BtnEdit_Click(object sender, RoutedEventArgs e) { int pos = DataGrid.SelectedIndex; if (pos == -1) { MessageBox.Show("Seleccione una carrera", "Error"); return; } Race race; try { race = (Race)DataGrid.SelectedItem; } catch (InvalidCastException) { return; } RaceForm window = new RaceForm((Race)race.Clone(), pos); window.ShowDialog(); }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { RaceForm window = new RaceForm(); window.ShowDialog(); }