bobwki
bobwki

Reputation: 944

How can I clear keyboard focus on a page when I exit and return?

I have a Xamarin.Forms (3.4) app with several Content pages, some of which have several entry boxes. If go to a page, then edit an entry, so far everything is fine. But when I "exit" the page (by doing a Navigation.PopModalAsync() ), and then return to the page, on iOS there is immediately a cursor in the entry, and also the keyboard pops-up. This is not what my user will expect.

On Android, the cursor is in the entry, but it does not pop up the keyboard automatically. This too is not desireable.

For refernce, on UWP it doesn't show focus when returning to the page.

How can I avoid this behavior? Is there a way to have the page "clear" the focus?

Upvotes: 2

Views: 1936

Answers (1)

Ivan I
Ivan I

Reputation: 9990

You should do something like:

override protected void OnAppearing()
{
  entry.Unfocus();
}

Upvotes: 4

Related Questions