How to limit the amount of characters in a Textbox
in xaml
and via code behind
?
How to limit the amount of characters in a Textbox
in xaml
and via code behind
?
It's quite simple:
in Xaml
add:
MaxLength="500"
and in the C # code:
NomeDoTextBox.MaxLength = 500;
If you have many textbox you can create a variable with this value:
public const int TamMaxCaracteres = 500;
NomeDoTextBox.MaxLength = TamMaxCaracteres;