-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
VisualStatesDirectlyOnElements.xaml
62 lines (57 loc) · 2.4 KB
/
VisualStatesDirectlyOnElements.xaml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?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.GalleryPages.VisualStateManagerGalleries.VisualStatesDirectlyOnElements"
Title="VisualStateGroups Directly on VisualElements">
<ContentPage.Content>
<StackLayout>
<Label x:Name="ALabel" Text="This is a label" HorizontalTextAlignment="Start" HorizontalOptions="Start" >
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ColorStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Invalid">
<VisualState.Setters>
<Setter Property="TextColor" Value="DarkRed"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="AlignmentStates">
<VisualState x:Name="LeftAligned">
</VisualState>
<VisualState x:Name="Centered">
<VisualState.Setters>
<Setter Property="HorizontalTextAlignment" Value="Center"/>
<Setter Property="HorizontalOptions" Value="Fill"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Label>
<Button x:Name="AButton" Text="Button" ContentLayout="Left" HorizontalOptions="Start" Image="coffee.png" TextColor="Blue">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ColorStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Invalid">
<VisualState.Setters>
<Setter Property="TextColor" Value="DarkRed"/>
<Setter Property="Image" Value="toolbar_close.png"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="AlignmentStates">
<VisualState x:Name="LeftAligned">
</VisualState>
<VisualState x:Name="Centered">
<VisualState.Setters>
<Setter Property="HorizontalOptions" Value="Center"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Button>
<Label x:Name="CurrentState"></Label>
<Button x:Name="ToggleValid" Text="Toggle Validity State" Clicked="ToggleValid_OnClicked"></Button>
<Button x:Name="ToggleAlignment" Text="Toggle Alignment State" Clicked="ToggleAlignment_OnClicked"></Button>
</StackLayout>
</ContentPage.Content>
</ContentPage>