ListViewUpdatedEventArgs.KeepInEditMode プロパティ

定義

更新操作後に ListView コントロールを編集モードのまま維持するかどうかを示す値を取得または設定します。

public:
 property bool KeepInEditMode { bool get(); void set(bool value); };
public bool KeepInEditMode { get; set; }
member this.KeepInEditMode : bool with get, set
Public Property KeepInEditMode As Boolean

プロパティ値

更新操作後にコントロールを編集モードのまま維持する場合は true。それ以外の場合は false。 既定値は、false です。

次の例では、 プロパティを KeepInEditMode 使用して、例外が発生したときにコントロールを ListView 編集モードに維持する方法を示します。 このコード例は、ListViewUpdatedEventArgs クラスのために提供されている大規模な例の一部です。

void ContactsListView_ItemUpdated(Object sender, ListViewUpdatedEventArgs e)
{
    if (e.Exception != null)
    {
        if (e.AffectedRows == 0)
        {
            e.KeepInEditMode = true;
            Message.Text = "An exception occurred updating the contact. " +
                                "Please verify your values and try again.";
        }
        else
            Message.Text = "An exception occurred updating the contact. " +
                                "Please verify the values in the recently updated item.";

        e.ExceptionHandled = true;
    }
}
Sub ContactsListView_ItemUpdated(sender As Object, e As ListViewUpdatedEventArgs)
    If e.Exception IsNot Nothing Then
        If e.AffectedRows = 0 Then
            e.KeepInEditMode = True
            Message.Text = "An exception occurred updating the contact. " & _
                                "Please verify your values and try again."
        Else
            Message.Text = "An exception occurred updating the contact. " & _
                                "Please verify the values in the recently updated item."
        End If

        e.ExceptionHandled = True
    End If
End Sub

注釈

既定では、コントロールは ListView 更新操作の後に読み取り専用モードに戻ります。 コントロールをKeepInEditMode編集モードのままにするように指定するには、 プロパティを ListViewtrue設定します。 これにより、ユーザーが入力した値も保持されます。

適用対象

こちらもご覧ください