ListViewUpdatedEventArgs.KeepInEditMode Właściwość

Definicja

Pobiera lub ustawia wartość wskazującą, czy kontrolka ListView powinna pozostać w trybie edycji po operacji aktualizacji.

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

Wartość właściwości

true jeśli kontrolka powinna pozostać w trybie edycji po operacji aktualizacji; w przeciwnym razie , false. Wartość domyślna to false.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą KeepInEditMode właściwości zachować ListView kontrolę w trybie edycji, gdy wystąpi wyjątek. Ten przykład kodu jest częścią większego przykładu udostępnionego ListViewUpdatedEventArgs dla klasy .

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

Uwagi

Domyślnie kontrolka ListView powraca do trybu tylko do odczytu po operacji aktualizacji. KeepInEditMode Ustaw właściwość na , aby true określić, że kontrolka ListView powinna pozostać w trybie edycji. Spowoduje to również zachowanie wartości wprowadzonych przez użytkownika.

Dotyczy

Zobacz też