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
プロパティ値
データ項目が ListView コントロールに表示される、0 から始まる位置。
実装
例
次の例では、 プロパティを 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 取得できます。
注意
このプロパティは、データ項目にのみ適用されます。 項目の挿入や空の項目には適用されません。