共用方式為


BindingGroup.BeginEdit 方法

定義

開始對 BindingGroup 中的來源,進行編輯異動。

public:
 void BeginEdit();
public void BeginEdit ();
member this.BeginEdit : unit -> unit
Public Sub BeginEdit ()

範例

下列範例會在視窗載入以開始編輯交易時呼叫 BeginEdit

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

備註

如果支援捨棄擱置變更的來源 BindingGroup ,您可以呼叫 BeginEdit 以開始編輯交易、呼叫 CommitEdit 以儲存暫止的變更、呼叫 CancelEdit 來捨棄擱置的變更。

針對實作 IEditableObject 的每個 Items 物件, BeginEdit 呼叫IEditableObject.BeginEdit

適用於