private void BtnAdd_Click(object sender, RoutedEventArgs e)//extra pokedex entry aanmaken { List <int> Idlist = new List <int>(); foreach (Pokedex pokedexEntry in pokedexentries) { Idlist.Add(pokedexEntry.Id); } pokedexEntry.Id = 1; while (Idlist.Contains(pokedexEntry.Id)) { pokedexEntry.Id += 1; } pokedexEntry.PokemonName = txtNaam.Text; pokedexEntry.Type1 = cmbType1.SelectedIndex + 1; pokedexEntry.Type2 = cmbType2.SelectedIndex + 1; pokedexEntry.PokemonDescription = "Nothing"; pokedexEntry.PokemonWeight = 50.0M; pokedexEntry.ExpMax = 160; pokedexEntry.EvolveItems = null; pokedexEntry.CaptureRate = 45; pokedexEntry.EvolveThreshold = null; DatabaseOperations.AddPokedexEntry(pokedexEntry); //refresh datagridPokedexEntries.ItemsSource = DatabaseOperations.PokedexEntry(); //refresh }