private void tabParticleEN_Checked(object sender, RoutedEventArgs e) { if (tabParticleEN.IsChecked.Value) { int index = tabParticleSel.SelectedIndex; for (int i = 0; i < asd.getParticleStrCount(); i++) { tabParticleSel.Items.RemoveAt(0); } for (int i = 0; i < asd.getParticleStrCount(); i++) { tabParticleSel.Items.Add(asd.getParticleStrEn(i)); } tabParticleSel.SelectedIndex = index; } }