Gets the collection of System.Windows.Forms.ListViewGroup objects assigned to the control.
Documentation for this section has not yet been entered.
The System.Windows.Forms.ListView grouping feature lets you create visual groups of logically related System.Windows.Forms.ListView items. Each group consists of a textual header followed by a horizontal line and the items assigned to that group. You can align the header text to the left, right, or center of the control. Any groups assigned to a System.Windows.Forms.ListView control appear whenever the ListView.View property is set to a value other than View.List.
System.Windows.Forms.ListView groups help your users find the items they are looking for by separating the items into useful categories. You can create whatever categories you need. One typical approach is to group the items based on the way the list is sorted. For example, you can group the items by the initial letter of the item name when the list is sorted alphabetically or by subitems such as type or date when the list is sorted by clicking a column header in the details view. Windows Explorer uses this type of grouping.
To use the grouping feature, add one or more System.Windows.Forms.ListViewGroup objects to the ListView.Groups collection of a System.Windows.Forms.ListView control. Set the group header text and header alignment in the ListViewGroup.#ctor constructor, or set them using the ListViewGroup.Header and ListViewGroup.HeaderAlignment properties.
To temporarily disable the grouping feature, set the ListView.ShowGroups property to false.
You can assign an item to a group by specifying the group in the ListViewItem.#ctor constructor, by setting the ListViewItem.Group property, or by directly adding the item to the ListViewGroup.Items collection of a group. All items should be assigned to groups before they are displayed. Any items that are not assigned to a group will appear in the default group, which has the header label "DefaultGroup{0}". 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.
An item can only be in one group at a time. You can change the group to which an item belongs by setting the ListViewItem.Group property at run time or by adding it to the ListViewGroup.Items collection of another group, which automatically removes it from the previous group.
The insertion mark feature is disabled when using groups. This is because the grouping feature orders items by group membership, while the insertion mark feature is used with drag-and-drop repositioning in a System.Windows.Forms.ListView control that does not already order its items.
System.Windows.Forms.ListView groups are available only on Windows XP and Windows Server 2003 when your application calls the Application.EnableVisualStyles method. On earlier operating systems, any code relating to groups has no effect and the groups will not appear. As a result, any code that depends on the grouping feature might not work correctly.
You might want to include code that determines whether the grouping feature is available, and provide alternate functionality when it is unavailable. For example, you might want to provide alternate sorting when running on operating systems that do not support sorting by group.
The grouping feature is provided by the same library that provides the operating system themes feature. To check for the availability of this library, call the FeatureSupport.IsPresent(object) method overload and pass in the OSFeature.Themes value.