public void DeleteItem(ExtendedComboBoxItem item) { if (item.Equals(m_addItem)) { return; } int itemIndex = Items.IndexOf(item); if (itemIndex > -1) { this.Items.Remove(item); if (itemIndex > 0) { this.SelectedIndex = itemIndex - 1; } else if (Items.Count > 1) { this.SelectedIndex = 0; } else { this.SelectedIndex = -1; } } }
public void InsertItemAtIndex(int index, ExtendedComboBoxItem item) { if (index > this.Items.Count - 1) { Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage( "INVALID_INDEX", "Workshare.PolicyDesigner.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly()); Logger.LogError(errorMessage.LogString); throw new ArgumentException(errorMessage.DisplayString); } this.Items.Insert(index, item); }
public void InsertItem(ExtendedComboBoxItem item) { this.InsertItemAtIndex((this.Items.Count - 1), item); }