Property Trigger 說明
occurs when a property on a control is set to a particular value.Xaml
<?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="MVVMPractice.XF3_PropertyTrigger">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType = "Entry">
<Style.Triggers>
<Trigger
TargetType ="Entry"
Property="IsFocused"
Value="True">
<Setter Property="BackgroundColor" Value="#6699CC"></Setter>
<Setter Property="PlaceholderColor" Value="#99CCFF" />
<Setter Property="TextColor" Value="#FFFFFF" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Entry Placeholder="請輸入 Email" WidthRequest="300"></Entry>
<Entry Placeholder="請輸入密碼" WidthRequest="300" IsPassword="True"></Entry>
</StackLayout>
</ContentPage.Content>
</ContentPage>
執行結果-1執行結果-2
執行結果-3
沒有留言:
張貼留言