Forum Xamarin.Forms

How to hide keyboard when focusing Entry?

KayKuoKayKuo Member ✭✭✭

I have a Xamarin.forms project, I have a page with an Entry control, I want to hide the keyboard when the Entry gets the focus ,because it is for scanning barcode labels, how can I achieve that?
The following code can implement hidden keyboard, but the keyboard occasionally shows,especially when the entry is empty.
How can I avoid it?thanks
here is my caode :
Control.InputType = 0;
Control.ShowSoftInputOnFocus = false;
InputMethodManager inputMethodManager = Control.Context.GetSystemService(Context.InputMethodService) as InputMethodManager;
inputMethodManager?.HideSoftInputFromWindow(Control.WindowToken, HideSoftInputFlags.None);

Best Answer


Sign In or Register to comment.