Xamarin Community Toolkit EmailValidationBehavior

The EmailValidationBehavior is a behavior that allows users to determine whether or not text input is a valid e-mail address. For example, an Entry control can be styled differently depending on whether a valid or an invalid e-mail address is provided. The validation is achieved through a regular expression that is used to verify whether or not the text input is a valid e-mail address. It can be overridden to customize the validation through the properties it inherits from ValidationBehavior.

Syntax

<Entry Placeholder="Email">
    <Entry.Behaviors>
        <xct:EmailValidationBehavior
            DecorationFlags="Trim"
            InvalidStyle="{StaticResource InvalidEntryStyle}"
        />
    </Entry.Behaviors>
</Entry>

Properties

Property Type Description
DefaultRegexPattern string The regular expression used to verify whether or not the text input is a valid e-mail address.

Sample

You can see this in action in the Xamarin Community Toolkit Sample App.

API