w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Capture iOS UITextField clear event with Xamarin

They are methods because they actually return a value. C# Events are just a way to receive an event sent by the objet.

When an UITextField starts (the keyboard is shown and the object is ready to manage input events), the event Started is sent. You can use this one for clearing the UITextField

UITextField textField = new UITextField();
textField.Started += delegate {
     textField.Text = null;
};

For handling the tap on the clear button (this is sadly not an event, but the TextField is going to be cleared anyway if the delegate returns true):

UITextField textField = new UITextField();
textField.ShouldClear += delegate {
    // Insert the handling here
    return true;
};




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.