Xamarin Community Toolkit NumericValidationBehavior

The NumericValidationBehavior is a behavior that allows the user to determine if text input is a valid numeric value. For example, an Entry control can be styled differently depending on whether a valid or an invalid numeric input is provided. Additional properties handling validation are inherited from ValidationBehavior.

Syntax

<Entry>
    <Entry.Behaviors>
        <xct:NumericValidationBehavior
            InvalidStyle="{StaticResource InvalidEntryStyle}"
            MinimumValue="1.0"
            MaximumValue="100.0"
        />
    </Entry.Behaviors>
</Entry>

Properties

Property Type Description
MaximumDecimalPlaces int The maximum number of decimal places that will be allowed.
MaximumValue double The maximum numeric value that will be allowed.
MinimumDecimalPlaces int The minimum number of decimal places that will be allowed.
MinimumValue double The minimum numeric value that will be allowed.

Sample

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

API