I can not change the entry keyboard inside user conttrol
IMPLEMENTATION
User control
xml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentView
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
xmlns:control="clr-namespace:Projecro_3.ControlCostumiado"
prism:ViewModelLocator.AutowireViewModel="True"
Padding="10"
x:Class="Projecro_3.Controls.EntryControl">
<AbsoluteLayout>
<control:CustomEntry x:Name="entry"> </control:CustomEntry>
</AbsoluteLayout>
</ContentView>
Classe:
namespace Projecro_3.Controls
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class EntryControl : ContentView, INotifyPropertyChanged
{
public Keyboard Teclado { get; set; }
public static readonly BindableProperty TecladoProperty = BindableProperty.Create(
propertyName: "Teclado",
returnType: typeof(Keyboard),
declaringType: typeof(EntryControl),
defaultValue: Keyboard.Default,
defaultBindingMode: BindingMode.TwoWay,
propertyChanged: TecladoPropertyChanged);
public EntryControl()
{
InitializeComponent();
entry.BindingContext = this;
}
private static void TecladoPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
var control = (EntryControl)bindable;
if (control == null) return;
control.entry.Keyboard = (Keyboard)newValue;
}
}
}
MainPage
<control:EntryControl Grid.Row="0" Teclado="Numeric" WidthRequest="180" PathIconeInicial="lock.png" Titulo="Alegria" Placeholder="Number" ></control:EntryControl>
I set the numeric keyboard, it prevents typing texts but does not change keyboard.