BindingGroup.CommitEdit Metodo

Definizione

Esegue tutti gli ValidationRule oggetti e aggiorna le origini di associazione se tutte le regole di convalida hanno esito positivo.

public:
 bool CommitEdit();
public bool CommitEdit();
member this.CommitEdit : unit -> bool
Public Function CommitEdit () As Boolean

Valori restituiti

true se ogni ValidationRule operazione ha esito positivo e i valori vengono sottoposti a commit nelle origini; in caso contrario, false.

Esempio

Nell'esempio seguente viene chiamato CommitEdit per salvare le modifiche in sospeso e quindi chiamare BeginEdit per preparare l'origine da modificare nuovamente.

void stackPanel1_Loaded(object sender, RoutedEventArgs e)
{
    // Set the DataContext to a PurchaseItem object.
    // The BindingGroup and Binding objects use this as
    // the source.
    stackPanel1.DataContext = new PurchaseItem();

    // Begin an edit transaction that enables
    // the object to accept or roll back changes.
    stackPanel1.BindingGroup.BeginEdit();
}
Private Sub stackPanel1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
    ' Set the DataContext to a PurchaseItem object.
    ' The BindingGroup and Binding objects use this as
    ' the source.
    stackPanel1.DataContext = New PurchaseItem()

    ' Begin an edit transaction that enables
    ' the object to accept or roll back changes.
    stackPanel1.BindingGroup.BeginEdit()
End Sub

Commenti

Se ogni ValidationRule operazione riesce, questo metodo determina il commit delle modifiche in sospeso e la fine della transazione di modifica, se un oggetto di origine è in grado di eseguire questa operazione.

Per ogni oggetto in Items che implementa IEditableObject, CommitEdit chiama IEditableObject.EndEdit

Si applica a