I have a PCL which stores my MVVM pages in XAML. I have the following in the XAML file, but I'd like to disable the autocomplete feature on the keyboard. Does anyone know how I can do this in the XAML?
<Entry Text="{Binding Code}" Placeholder="Code" />
The KeyboardFlags should do it, something like:
Forms supports a KeyboardFlags.Suggestion enum which I assume is intended to control this behavior, but it doesn't appear to be very well documented.
Custom
Keyboard
instances can be created in XAML using thex:FactoryMethod
attribute. What you're wanting can be achieved with the following markup:KeyboardFlags.None
removes all special keyboard features from the field.Multiple enums can be specified in XAML by separating them with a comma:
When you don't need a custom
Keyboard
, you can use one of the predefined ones by taking advantage of thex:Static
attribute:While there's already an answer, I thought I'd elaborate a bit further about usage in XAML.
Unlike in code-behind, you cannot create a new instance of the Keyboard class to be used, but there IS a way. Hopefully you're already xaml-ified your App.cs (remove it, and create App.xaml and App.xaml.cs), that way you don't have to check if the Resources property has been initialized yet.
The next step is to override the OnStart() method, and add the proper entries for the various keyboards you use. I usually use three keyboards: numeric, e-mail and text. Another useful one is the Url keyboard, but you can add it the same way.
This little code will make the keyboards available as static resources. To use them in XAML, just do the following:
And voilá, your entry now has an e-mail keyboard.