Skip to content

Instantly share code, notes, and snippets.

@ameerthehacker
Last active August 25, 2018 18:37
Show Gist options
  • Save ameerthehacker/a70799661d6bcab70d32e79917a50968 to your computer and use it in GitHub Desktop.
Save ameerthehacker/a70799661d6bcab70d32e79917a50968 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:Validators="clr-namespace:XamarinFormValidation.Validators.Implementations"
xmlns:Behaviors="clr-namespace:XamarinFormValidation.Behaviors"
xmlns:local="clr-namespace:XamarinFormValidation" x:Class="XamarinFormValidation.MainPage">
<StackLayout Padding="15">
<Label>Enter the mobile number</Label>
<Entry>
<Entry.Behaviors>
<Behaviors:ValidationBehavior PropertyName="Text">
<Behaviors:ValidationBehavior.Validators>
<Validators:RequiredValidator />
<Validators:FormatValidator
Message="Mobile number must be 10 digit"
Format="^[0-9]{10}$" />
</Behaviors:ValidationBehavior.Validators>
</Behaviors:ValidationBehavior>
</Entry.Behaviors>
</Entry>
</StackLayout>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment