List.ListItems Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a ListItemCollection containing the ListItem elements that comprise the contents of the List.
public:
property System::Windows::Documents::ListItemCollection ^ ListItems { System::Windows::Documents::ListItemCollection ^ get(); };
public System.Windows.Documents.ListItemCollection ListItems { get; }
member this.ListItems : System.Windows.Documents.ListItemCollection
Public ReadOnly Property ListItems As ListItemCollection
Property Value
A ListItemCollection containing the ListItem elements that comprise the contents of the List.
This property has no default value.
Examples
The following examples show how to perform common operations on a List using the ListItems property.
// Add ListItems to the List.
List listx = new List();
Span spanx = new Span();
listx.ListItems.Add(new ListItem(new Paragraph(new Run("A bit of text content..."))));
listx.ListItems.Add(new ListItem(new Paragraph(new Run("A bit more text content..."))));
// Insert a ListItem at the begining of the List.
ListItem lix = new ListItem(new Paragraph(new Run("ListItem to insert...")));
listx.ListItems.InsertBefore(listx.ListItems.FirstListItem, lix);
// Get the number of ListItems in the List.
int countListItems = listx.ListItems.Count;
// Remove the last ListItem from the List.
listx.ListItems.Remove(listx.ListItems.LastListItem);
// Clear all of the ListItems from the List.
listx.ListItems.Clear();
' Add ListItems to the List.
Dim listx As New List()
Dim spanx As New Span()
listx.ListItems.Add(New ListItem(New Paragraph(New Run("A bit of text content..."))))
listx.ListItems.Add(New ListItem(New Paragraph(New Run("A bit more text content..."))))
' Insert a ListItem at the begining of the List.
Dim lix As New ListItem(New Paragraph(New Run("ListItem to insert...")))
listx.ListItems.InsertBefore(listx.ListItems.FirstListItem, lix)
' Get the number of ListItems in the List.
Dim countListItems As Integer = listx.ListItems.Count
' Remove the last ListItem from the List.
listx.ListItems.Remove(listx.ListItems.LastListItem)
' Clear all of the ListItems from the List.
listx.ListItems.Clear()
Remarks
Use the ListItemCollection returned by this property to enumerate or manipulate the contents of a List element.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET