c# - Not to show keyboard when focusing a searchbox -
i developing app (in xamarin.forms) used external barcode scanner, i don't need show tactile keyboard each time put focus in entry/searchbox/etc.
how can this?
thanks guys.
assuming never want keyboard never show whatsoever on entry
, can set keyboard property null
in entry's constructor.
var scannerentry = new entry { keyboard = null, placeholder = "scan item" };
because xamarin.forms api not expose keyboard
property on searchbar
class, can write custom renderer. ios implementation can use resignfirstresponder
in onelementchanged
override prevent keyboard ever showing:
[assembly: exportrenderer(typeof(scannersearchbar), typeof(scannersearchbardrenderer))] namespace hidekeyboard.ios { public class scannersearchbarrenderer : searchbarrenderer { protected override void onelementchanged(elementchangedeventargs<xamarin.forms.searchbar> e) { base.onelementchanged(e); if (control != null) { if (focused) { resignfirstresponder(); } } } } }
Comments
Post a Comment