This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 864 - ValueChanged event is not fired for UITextField
Summary: ValueChanged event is not fired for UITextField
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS / monotouch (show other bugs)
Version: 4.x
Hardware: Macintosh Mac OS
: --- critical
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-09-16 15:31 UTC by Adrian Grigore
Modified: 2011-09-21 07:48 UTC (History)
2 users (show)

See Also:
Tags:


Attachments

Description Adrian Grigore 2011-09-16 15:31:32 UTC
The event "ValueChanged" is not fired on a UITextField when a charactor is
typed (or at all). 

(the Changed event IS fired in a UITextView, so I assume it's a typo?)

Steps to reproduce the problem:
1. Add a UITextField to a form. Wire it up
2. In MonoDevelop, attach to the field's ValueChanged event.
3. Put a breakpoint / logging in the valuechanged event code
4. watch it not fire the event as you type into the field


This bug seems identic to an old bug described at https://bugzilla.novell.com/show_bug.cgi?id=596930, but even though the bug is marked at RESOLVED, I was still able to reproduce it with version 4.0.7
Comment 1 Rolf Bjarne Kvinge 2011-09-21 07:48:58 UTC
The problem is that the native UITextField doesn't have (the native equivalent of) a Changed event, so there is nothing MonoTouch can hook up to.

There is however a notification you can observe (for the test project in the other bug report):

NSNotificationCenter.DefaultCenter.AddObserver (UITextField.TextFieldTextDidChangeNotification, (notification) =>
{
    Console.WriteLine ("Character received! {0}", notification.Object == TextField);
});

which will enable you to listen for when the text field's text changes.

Note You need to log in before you can comment on or make changes to this bug.