/// <summary> /// Adds a new element to the combo /// </summary> /// <param name="item">item to add</param> /// <param name="index">position to adding</param> public int AddItem(object item, int index = -1) { var newItem = CreateItem(item); if (index == -1 || index == ListBoxItems.Count) { ListBoxItems.Add(newItem); return(ListBoxItems.Count - 1); } ListBoxItems.Insert(index, newItem); return(index); }
private void OnAddItemCommandExecute() { ListBoxItems.Insert(0, CreateUser()); }