Dismiss the Keyboard

PDF for offline use
Sample Code:
Related SDKs:

Let us know how you feel about this

Translation Quality


0/250

This recipe will show how to hide the keyboard.

Recipe

The keyboard does not automatically disappear when the return key is pressed and may cover or obscure certain parts of the UI. To dismiss the keyboard, send the UIResponder.ResignFirstResponder message to the text field that is currently the first responder.

  1. Provide ShouldReturn with a delegate or anonymous method that will call ResignFirstResponder on the field:
this.txtDefault.ShouldReturn += (textField) => {
    textField.ResignFirstResponder();
    return true;
};

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.