//Função para permitir somente números e ponto
private void ApenasValorNumerico(object sender, KeyEventArgs e)
{
TextBox txt = (TextBox)sender;
if (e.Key != Key.Back)
{
if (Convert.ToChar(e.Key) == '.')
e.Handled = (txt.Text.Contains('.'));
else
e.Handled = true;
}
}
Well, I found this code in another post, and I modified it to try to use it in my WindowsPhone application, but I do not know where the error is .. I'm a beginner.. Thanks in advance for any help ..
PS: Actually there is no error, it just does not work .. the method is called but it does not allow inclusion in the textbox .. none of the "keys" works, neither numbers nor point.