共用方式為


Control.BindingContextChanged 事件

定義

發生於 BindingContext 屬性的值變更時。

public:
 event EventHandler ^ BindingContextChanged;
public event EventHandler BindingContextChanged;
public event EventHandler? BindingContextChanged;
member this.BindingContextChanged : EventHandler 
Public Custom Event BindingContextChanged As EventHandler 

事件類型

範例

下列程式碼範例會將委派新增 EventHandlerBindingContextChanged 控制項的事件 TextBox

private:
   void AddEventHandler()
   {
      textBox1->BindingContextChanged += gcnew EventHandler(
         this, &Form1::BindingContext_Changed );
   }

   void BindingContext_Changed( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      Console::WriteLine( "BindingContext changed" );
   }
private void AddEventHandler()
{
   textBox1.BindingContextChanged += new EventHandler(BindingContext_Changed);
}

private void BindingContext_Changed(object sender, EventArgs e)
{
   Console.WriteLine("BindingContext changed");
}
Private Sub AddEventHandler()
    AddHandler textBox1.BindingContextChanged, _
       AddressOf BindingContext_Changed
End Sub    
   
Private Sub BindingContext_Changed(sender As Object, e As EventArgs)
    Console.WriteLine("BindingContext changed")
End Sub

備註

若要透過 BindingContext 屬性將新的 BindingContext 新增至 Control ,請參閱建構函式 BindingContext

如果屬性變更是透過程式設計修改或使用者互動來變更, BindingContext 就會引發這個事件。

如需處理事件的詳細資訊,請參閱 處理和引發事件

適用於

另請參閱