Forum Xamarin.Forms

Adding validation in Entry Text in Xamarin Forms

crazygangcrazygang BDMember ✭✭

Hello,

Can somebody help to achieve a validation in an Entry Text in XAML ?

My validation rules are as follows:

  • The entry text cannot be null
  • The entry text cannot have only three or six characters. It should be more than that.

Please help. Thanks in advance.

Answers

  • ankushguptaankushgupta USMember ✭✭
    1. The entry text cannot be null :- !string.IsNullOrWhiteSpace(Entry.Text);
    2. if(Entry.Text.Length.Equals(3) || Entry.Text.Length.Equals(6))
  • crazygangcrazygang BDMember ✭✭

    @ankushgupta said:
    1. The entry text cannot be null :- !string.IsNullOrWhiteSpace(Entry.Text);
    2. if(Entry.Text.Length.Equals(3) || Entry.Text.Length.Equals(6))

    How can I implement this using behaviours in XAML ?

Sign In or Register to comment.