maui-linux/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml

37 строки
1.2 KiB
XML

<?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>