編輯

共用方式為


ListViewGroup.Items Property

Definition

Gets a collection containing all items associated with this group.

public:
 property System::Windows::Forms::ListView::ListViewItemCollection ^ Items { System::Windows::Forms::ListView::ListViewItemCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.ListView.ListViewItemCollection Items { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Items : System.Windows.Forms.ListView.ListViewItemCollection
Public ReadOnly Property Items As ListView.ListViewItemCollection

Property Value

A ListView.ListViewItemCollection that contains all the items in the group. If there are no items in the group, an empty ListView.ListViewItemCollection object is returned.

Attributes

Remarks

You can assign an item to a group by specifying the group in the ListViewItem constructor, by setting the ListViewItem.Group property, or by directly adding the item to the 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 Items collection of another group, which automatically removes it from the previous group.

Note

An item can be present within the Items collection of a group, but if it is not also present within the ListView.Items collection of the ListView control itself, it will not appear in the control.

Applies to

See also