Xamarin Community Toolkit TextValidationBehavior

The TextValidationBehavior is a behavior that allows the user to validate a given text depending on specified parameters. By adding this behavior to an Entry control it can be styled differently depending on whether a valid or an invalid text value is provided. It offers various built-in checks such as checking for a certain length or whether or not the input value matches a specific regular expression. Additional properties handling validation are inherited from ValidationBehavior.


            InvalidStyle="{StaticResource InvalidEntryStyle}"


Property Type Description
DecorationFlags TextDecorationFlags Provides enumerated value to use to set how to handle white spaces.
MaximumLength int The maximum length of the value that will be allowed.
MinimumLength int The minimum length of the value that will be allowed.
RegexOptions RegexOptions Provides enumerated values to use to set regular expression options.
RegexPattern string The regular expression pattern which the value will have to match before it will be allowed.



Currently there's no sample available for this feature yet. Want to add one? We are open to community contributions.