Reputation:
Hai,
I tried to create a ListViewControl (tile mode) and added a ListViewItem. I created it like this,
ListViewItem aFooItem = new ListViewItem("foo");
listView1.Items.Add(aFooItem); //Adding the ListViewItem to the ListViewControl
Now I ran the application and tried to debug the first line. I found that the aFooItem's subitems count is 1 and is similar to aFooItem itself. Could somebody help me why the aFooItem's SubItems.Count is 1, even thou' I didn't add an item to it explicitly ??
Upvotes: 0
Views: 220
Reputation: 12210
The default value of a ListViewItem
is the value of the sub-item at index 0. When you create a ListViewItem
it automatically creates the default sub-item for you.
Upvotes: 1
Reputation: 204249
A ListViewItem's "SubItems" is the list of columns it contains. By initializing your ListViewItem with a default string ("foo") you've added one subitem (with Text == "foo").
Upvotes: 1