Gets or sets the group to which the item is assigned.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Use this property to set the group to which an item belongs. You can also set the group in the ListViewItem constructor, or you can use this property to modify the group membership at run time. If you set this property to null and there are groups in the ListView.Groups collection, the item will appear in the default group, which has the header label "DefaultGroupSystem.Windows.Forms". The default group is not contained in the ListView.Groups collection, and cannot be altered. It is primarily useful in debugging to ensure that all items have been properly added to groups.
The following code example demonstrates how the ListView items by subitem value in the details view. This form of grouping is similar to the grouping used in Windows Explorer. In the example, the groups are created dynamically. For each subitem column, one group is created for each unique subitem value. For the parent item column, one group is created for each unique initial letter. The groups created for each column are stored in a hash table along with the subitem text or initial letter. When a column header is clicked, the hash table corresponding to that column is retrieved. Next, the subitem text values for that column are used as hash table keys to retrieve the correct group for each item. The item is then assigned to the group using the property.property can be used in an application that organizes
This code example is part of a larger example provided for the ListView.Groups property.
Available since 2.0