I need to enable the user to enter negative values in my xamarin application entry fields fro IOS project. Currently i use the following custom renderer to use the NumbersAndPunctuation keypad. But i do not want an alphanumeric keypad for entrering only numeric inputs. Is there a better solution for the same?
public class NumericKeypadRenderer: EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control == null) return;
Control.KeyboardType = UIKeyboardType.NumbersAndPunctuation;
}
}
Is there a way to just add a minus button to the numeric keypad in IOS?
We can't only add a custom button on the default keyboard. We need to customize the keyboard to achieve that.
You could follow this thread to create your keyboard:Custom Keyboard in Xamarin forms
There is an sample in this link, you could refer to his customrenderer : https://github.com/Eren-Shen/CustomKeyboardDemo/tree/master/CustomKeyboardDemo/CustomKeyboardDemo.iOS