0
我想知道是否有什么东西接近Xamarin Forms中的KeyPressEventArgs,因为我需要验证一些字段。这里是一个Windows窗体的例子。Xamarin.Forms/KeyPressEventArgs
public static bool ValideringTlf(KeyPressEventArgs e)
{
return (e.Handled = char.IsNumber(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == 127 ? false : true);
}
public static bool ValideringNavn(KeyPressEventArgs e)
{
return (e.Handled = char.IsLetter(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == 32 || e.KeyChar == 127 ? false : true);
}
public static bool ValideringVejnr(KeyPressEventArgs e)
{
return (e.Handled = char.IsNumber(e.KeyChar) || char.IsLetter(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == 127 ? false : true);
}
public static bool ValideringPostnr(KeyPressEventArgs e)
{
return (e.Handled = char.IsNumber(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == 127 ? false : true);
}
这些数字来自Ascii Tabel。