I have an entry field in Xamarin.Forms.
On Android, I can't enter either a comma or a dot to make decimals. The entry just accepts integral numbers. What do I have to change to be able to enter decimals?
Xaml:
<Entry Keyboard="Numeric" Text="{Binding Price1}" Placeholder="Price"/>
Content page cs:
private decimal price1;
public string Price1
{
get { return (price1).ToString(); }
set
{
price1 = Convert.ToDecimal((String.IsNullOrEmpty(value)) ? null : value);
OnPropertyChanged(nameof(Price1));
}
}
The quickest way is to create a string property with binding , and convert to decimal when using it .
ViewModel
Usage