Sub-items

Every item within the list view can contain sub-items. These can be accessed using BetterListViewItem.SubItems collection.

Sub-items are displayed only in the Details view when the columns are present. Each item can have any number of sub-items, but the number of sub-items displayed is limited by the number of column headers.

The following screenshot shows Better ListView with items and sub-items displayed on the right of each items (in columns) with one sub-item being focused (see Focusing Elements for more information):

Copying sub-items

The sub-item collection behaves differently than other collections present in Better ListView.

It always have to contain at least one sub-item. Even if you call Clear method, one sub-item remains in the collection. This is because this sub-item represents properties of the item itself.

To copy sub-items from one item to another, you have to consider setting the first sub-item, while adding the other:

C#

itemTarget.SubItems[0] = (BetterListViewSubItem)itemSource.SubItems[0].Clone();

for (int indexSubItem = 1; indexSubItem < itemSource.SubItems.Count; indexSubItem++)
{
  itemTarget.SubItems.Add((BetterListViewSubItem)itemSource.SubItems[indexSubItem].Clone());
}

Visual Basic

itemTarget.SubItems(0) = DirectCast(itemSource.SubItems(0).Clone(), BetterListViewSubItem)

For indexSubItem As Integer = 1 To itemSource.SubItems.Count - 1
  itemTarget.SubItems.Add(DirectCast(itemSource.SubItems(indexSubItem).Clone(), BetterListViewSubItem))
Next