summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml
blob: accd9186f8b8dd23bdebb42e52772a8efba15a8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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="Xamarin.Forms.Controls.BehaviorsAndTriggers"
	xmlns:local="clr-namespace:Xamarin.Forms.Controls;assembly=Xamarin.Forms.Controls"
	Padding="8">
	<StackLayout>
		<Label Text="Type red in the entry below" />
		<Entry x:Name="entry" BackgroundColor="Lime">
			<Entry.Triggers>
				<Trigger TargetType="Entry" Property="Text" Value="red">
					<Setter Property="Entry.BackgroundColor">
						<Color>#ff0000</Color>
					</Setter>
					<Trigger.EnterActions>
						<local:HThrob />
					</Trigger.EnterActions>
					<Trigger.ExitActions>
						<local:VThrob />
					</Trigger.ExitActions>
				</Trigger>
				<Trigger TargetType="Entry" Property="IsFocused" Value="true">
					<Setter Property="Entry.BackgroundColor">
						<Color>#0000ff</Color>
					</Setter>
				</Trigger>
			</Entry.Triggers>
		</Entry>
		<Button Text="Click me!">
			<Button.Behaviors>
				<local:StopItBehavior />
			</Button.Behaviors>
		</Button>
		<Label BindingContext="{x:Reference entry}" Text="{Binding Path=IsFocused}" />
	</StackLayout>
</ContentPage>