ListViewDataItem.DisplayIndex 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤에 표시된 ListView 데이터 항목의 위치를 가져옵니다.
public:
virtual property int DisplayIndex { int get(); };
public virtual int DisplayIndex { get; }
public override int DisplayIndex { get; }
member this.DisplayIndex : int
Public Overridable ReadOnly Property DisplayIndex As Integer
Public Overrides ReadOnly Property DisplayIndex As Integer
속성 값
컨트롤에 표시된 데이터 항목의 위치(0부터 시작하는 ListView 위치)입니다.
구현
예제
다음 예제에서는 편집 중인 항목의 인덱스를 검색 하는 속성을 사용 DisplayIndex 하는 방법을 보여 집니다. 이 코드 예제는 메서드에 제공된 더 큰 예제의 ListView.UpdateItem 일부입니다.
protected void PreferredCheckBox_CheckedChanged(object sender, EventArgs e)
{
// Gets the CheckBox object that fired the event.
CheckBox chkBox = (CheckBox) sender;
// Gets the item that contains the CheckBox object.
ListViewDataItem item = (ListViewDataItem) chkBox.Parent.Parent;
// Update the database with the changes.
VendorsListView.UpdateItem(item.DisplayIndex, false);
}
Protected Sub PreferredCheckBox_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
' Gets the CheckBox object that fired the event.
Dim chkBox As CheckBox = CType(sender, CheckBox)
' Gets the item that contains the CheckBox object.
Dim item As ListViewDataItem = CType(chkBox.Parent.Parent, ListViewDataItem)
' Update the database with the changes.
VendorsListView.UpdateItem(item.DisplayIndex, False)
End Sub
설명
이 속성은 DisplayIndex 컨트롤에 표시된 항목의 현재 위치에 해당합니다 ListView . 각 항목의 DisplayIndex 값은 데이터의 특정 페이지에서 컨트롤에 추가된 순서를 반영합니다. 이 DisplayIndex 속성을 사용하여 컬렉션에서 개체를 ListViewDataItem 검색할 Items 수 있습니다.
메모
이 속성은 데이터 항목에만 적용됩니다. 항목 또는 빈 항목을 삽입하는 데는 적용되지 않습니다.