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 属性向 Control 添加新BindingContext的 ,请参阅 BindingContext 构造函数。

如果 BindingContext 通过编程修改或用户交互更改属性,则会引发此事件。

有关处理事件的详细信息,请参阅 处理和引发事件

适用于

另请参阅