Control.BindingContextChanged Control.BindingContextChanged Control.BindingContextChanged Control.BindingContextChanged Event

定義

發生於 BindingContext 屬性的值變更時。Occurs when the value of the BindingContext property changes.

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

範例

下列程式碼範例會將EventHandler委派給BindingContextChanged事件的TextBox控制項。The following code example adds an EventHandler delegate to the BindingContextChanged event of a TextBox control.

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

備註

若要加入新BindingContextControl透過BindingContext屬性,請參閱BindingContext建構函式。To add a new BindingContext to the Control through the BindingContext property, see the BindingContext constructor.

如果會引發這個事件BindingContext屬性變更時變更以程式設計方式修改或使用者互動。This event is raised if the BindingContext property is changed is changed by either a programmatic modification or user interaction.

如需有關如何處理事件的詳細資訊,請參閱 < 處理和引發事件For more information about handling events, see Handling and Raising Events.

適用於

另請參閱