private void AutoUpdateCheckbox_Unchecked(object sender, RoutedEventArgs e) { var loc = (Location)CityList.SelectedItem; if (loc.Update == false) { return; } int index = Locations.IndexOf(loc); var replaced = Locations[index]; var newLocation = new Location(replaced.Name, replaced.X, replaced.Y, false); Locations[index] = newLocation; CityList.SelectedIndex = Locations.IndexOf(loc); XManager.ReplaceLocation(replaced, newLocation); }