public ListViewSubItem Insert(int index, ListViewSubItem item) { ListViewSubItem newSubItem = new ListViewSubItem(_viewModel, index); newSubItem.Text = ((ListViewSubItem)item)._text ?? ""; return(newSubItem); }
/// <summary> /// Add a new SubItem to the ListViewItem /// </summary> /// <param name="newItem"></param> /// <param name="index"></param> internal int AddItem(ListViewSubItem newSubItem, int index = -1) { if (index == -1 || index == SubItems.Count) { SubItems.Add(newSubItem); return(SubItems.Count - 1); } SubItems.Insert(index, newSubItem); return(index); }
/// <summary> /// Look for an specific subitem /// </summary> /// <param name="listViewSubItem"></param> /// <returns></returns> internal bool ContainsSubItem(ListViewSubItem listViewSubItem) { foreach (ListViewSubItem sub in SubItems) { if (sub.Text.Equals(listViewSubItem.Text)) { return(true); } } return(false); }
/// <summary> /// Removes a subitem /// </summary> /// <param name="listViewSubItem"></param> public void RemoveSubItem(ListViewSubItem listViewSubItem) { List <string> tmp = new List <string>(); foreach (string content in ItemContent) { if (!content.Equals(listViewSubItem.Text)) { tmp.Add(content); } } ItemContent = tmp.ToArray <string>(); }
/// <summary> /// Look for an specific subitem /// </summary> /// <param name="listViewSubItem"></param> /// <returns></returns> internal bool ContainsSubItemKey(ListViewSubItem listViewSubItem) { if (listViewSubItem != null) { foreach (ListViewSubItem sub in SubItems) { if (sub.Name.Equals(listViewSubItem.Name)) { return(true); } } } return(false); }
public ListViewSubItem Add(ListViewSubItem item) { _viewModel.AddItem(item); return(_viewModel.SubItemsViewModels.Last <ListViewSubItem>()); }