ListViewUpdatedEventArgs.KeepInEditMode Proprietà

Definizione

Ottiene o imposta un valore che indica se il controllo ListView deve rimanere in modalità di modifica dopo un'operazione di aggiornamento.

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

Valore della proprietà

true se il controllo deve rimanere in modalità di modifica dopo un'operazione di aggiornamento; in caso contrario, false. Il valore predefinito è false.

Esempio

Nell'esempio seguente viene illustrato come utilizzare la KeepInEditMode proprietà per mantenere un ListView controllo in modalità di modifica quando si verifica un'eccezione. Questo esempio di codice fa parte di un esempio più ampio fornito per la ListViewUpdatedEventArgs classe .

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

Commenti

Per impostazione predefinita, il ListView controllo torna alla modalità di sola lettura dopo un'operazione di aggiornamento. Impostare la KeepInEditMode proprietà su true per specificare che il ListView controllo deve rimanere in modalità di modifica. In questo modo vengono mantenuti anche i valori immessi dall'utente.

Si applica a

Vedi anche