public void Remove(OutlookBarBand band) { // Make sure currentBandIndex is always valid int currentBandIndex = parentBar.GetCurrentBand(); bool updateCurrentIndex = currentBandIndex != -1 && currentBandIndex == Count - 1; InnerList.Remove(band); if (updateCurrentIndex) { // Since we just removed the currently selected band, // set the new selected band to last band if (Count > 0) { parentBar.SetCurrentBand(Count - 1); } } RaiseChanged(); }