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使用して、コレクション内のオブジェクトをListViewDataItemItems取得できます。
注意
このプロパティは、データ項目にのみ適用されます。 項目の挿入や空の項目には適用されません。
適用対象
こちらもご覧ください
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示