ListViewDataItem.DisplayIndex Özellik

Tanım

Denetimde görüntülenen veri öğesinin ListView konumunu alır.

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

Özellik Değeri

Int32

Denetimde ListView görüntülenen veri öğesinin sıfır tabanlı konumu.

Uygulamalar

Örnekler

Aşağıdaki örnekte, özelliğin DisplayIndex düzenlendiği öğenin dizinini almak için nasıl kullanılacağı gösterilmektedir. Bu kod örneği, yöntemi için ListView.UpdateItem sağlanan daha büyük bir örneğin parçasıdır.

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

Açıklamalar

özelliği, DisplayIndex denetim tarafından görüntülenen öğenin geçerli konumuna ListView karşılık gelir. Her öğenin DisplayIndex değeri, söz konusu veri sayfasındaki denetime eklendikleri sırayı yansıtır. özelliğini kullanarak DisplayIndex koleksiyondaki Items bir ListViewDataItem nesneyi alabilirsiniz.

Not

Bu özellik yalnızca veri öğeleri için geçerlidir. Öğe veya boş öğe eklemek için geçerli değildir.

Şunlara uygulanır

Ayrıca bkz.