/// <summary> /// /// </summary> /// <param name="item"></param> public void AddItem(string item) { if (!string.IsNullOrWhiteSpace(item)) { ItemsListbox.Items.Add(item); ItemsListbox.ScrollIntoView(item); } }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="value"></param> public void AddItem(string key, string value) { if (!string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(value)) { bool itemFound = false; foreach (PairValue item in ItemsListbox.Items) { if (item.Key.Equals(key)) { item.Value = value; itemFound = true; break; } } if (!itemFound) { PairValue item = new PairValue(key, value); ItemsListbox.Items.Add(item); ItemsListbox.ScrollIntoView(item); } } }