Skip to content Skip to sidebar Skip to footer

Uitextfield Keypress Handler In Xamarin.ios

In my xamarin.android project i am having a screen in which edittext have been used, which is of type numberdecimal. here i am getting the textchanged event on keyPress and appendi

Solution 1:

You can quite easily achieve that, albeit it's been wrapped differently in iOS. Handle it with delegates, not EventHandlers

Set your TextField's delegate to this, in your controller:

field.Delegate = this;

Make sure your controller implements IUITextFieldDelegate

Then implement the following the method:

    [Export("textField:shouldChangeCharactersInRange:replacementString:")]
    publicboolShouldChangeCharacters(UITextField textField, NSRange range, string replacementString)
    {
        returntrue;
    }

That's called every time text changes, and you can also get the value from the function.

Post a Comment for "Uitextfield Keypress Handler In Xamarin.ios"