<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
			 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
			 x:Class="WorkingWithTriggers.DataTriggerXaml"
			 Padding="20, 50, 20, 0">
	<StackLayout Spacing="20">

		<Label FontSize="Large">DataTrigger Example</Label>

		<Label Text="Entry requires length>0 before button is enabled" FontSize="Small" />

        <Entry
        	   Text=""
               Placeholder="required field" /><!-- referenced below in DataTrigger-->

        <Button x:Name="button" Text="Save"
                FontSize="Large"
                HorizontalOptions="Center">
            <Button.Triggers>
                <DataTrigger TargetType="Button"
                             Binding="{Binding Source={x:Reference entry},
                                               Path=Text.Length}"
                             Value="0">
                    <Setter Property="IsEnabled" Value="False" />
                </DataTrigger>
            </Button.Triggers>
        </Button>

    </StackLayout>
</ContentPage>
