Xamarin: UITextField textchanged event

UITextField for MonoTouch is equivalent to your basic text box control in .NET.  The default event handler for the textbox is the text changed event which is quite helpful for processing text as a user types.

   private void textBox1_TextChanged(object sender, EventArgs e)
   {

   }

The UITextField does not come with a textchanged event so to get similar functionality you need to wire up an Observer yourself.

In ViewDidLoad() place your observer.

NSNotificationCenter.DefaultCenter.AddObserver
(UITextField.TextFieldTextDidChangeNotification,TextChangedEvent );

This will observe ALL UITextFields for the notification type.  The TextChangedEvent method will be called.

    private void TextChangedEvent(NSNotification notification)
    {
            UITextField field = (UITextField)notification.Object;

            if (notification.Object == txt_Name)
            {
              // do work

            }
    }

You can match for specific instances of UITextField in here.