xamarin-forms-samples/Behaviors/NumericValidationBehaviorStyle
David Britch 16fe79451c
Updated TargetPlatformVersion on UWP (#684)
2021-01-07 12:26:28 +00:00
..
Screenshots de-duplicate csproj GUIDs (#511) 2019-08-19 08:12:34 -07:00
WorkingWithBehaviors Mass update to Forms 5.0. (#682) 2021-01-06 17:47:24 +00:00
WorkingWithBehaviors.Android Mass update to Forms 5.0. (#682) 2021-01-06 17:47:24 +00:00
WorkingWithBehaviors.UWP Updated TargetPlatformVersion on UWP (#684) 2021-01-07 12:26:28 +00:00
WorkingWithBehaviors.iOS Mass update to Forms 5.0. (#682) 2021-01-06 17:47:24 +00:00
NumericValidationBehaviorStyle.sln Enabled deploy. 2020-03-27 12:46:11 +00:00
README.md Link fixes. 2020-07-08 15:56:01 +01:00

README.md

name description page_type languages products urlFragment
Xamarin.Forms - Numeric validation behavior with style Xamarin.Forms behaviors can be consumed by an explicit or implicit style. This sample shows how to consume a behavior with an explicit style sample
csharp
xamarin
behaviors-numericvalidationbehaviorstyle

Numeric Validation Behavior with Style

Xamarin.Forms behaviors can be consumed by an explicit or implicit style. This sample demonstrates how to consume a Xamarin.Forms behavior with an explicit style.

<ContentPage.Resources>
    <ResourceDictionary>
        <Style x:Key="NumericValidationStyle" TargetType="Entry">
            <Style.Setters>
                <Setter Property="local:NumericValidationBehavior.AttachBehavior" Value="true" />
            </Style.Setters>
        </Style>
    </ResourceDictionary>
</ContentPage.Resources>
<StackLayout Padding="10,50,10,0">
    <Label Text="Red when the number isn't valid" FontSize="Small" />
    <Entry Placeholder="Enter a System.Double" Style="{StaticResource NumericValidationStyle}" />
</StackLayout>

NumericValidation Behavior with Style application screenshot

For more information about this sample, see Behaviors.