-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
StateTriggerToggleGallery.xaml
61 lines (59 loc) · 2.8 KB
/
StateTriggerToggleGallery.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
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries.StateTriggerToggleGallery"
Title="StateTriggerToggle Gallery">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="StateTriggerGridStyle" TargetType="Grid">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup>
<VisualState x:Name="Wide">
<VisualState.StateTriggers>
<StateTrigger IsActive="{Binding ToggleState}"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Green" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Narrow">
<VisualState.StateTriggers>
<StateTrigger IsActive="{Binding ToggleStateInverted}"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="Red" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<Grid
Style="{StaticResource StateTriggerGridStyle}">
<Frame
HorizontalOptions="Center"
VerticalOptions="Center"
BackgroundColor="White"
CornerRadius="12"
Margin="24">
<StackLayout
Orientation="Horizontal">
<CheckBox
x:Name="CheckBox"
IsChecked="{Binding ToggleState, Mode=TwoWay}"
VerticalOptions="Center"/>
<Label
Text="Checked/Uncheck the CheckBox to modify the Grid BackgroundColor"
VerticalOptions="Center"/>
</StackLayout>
</Frame>
</Grid>
</ContentPage.Content>
</ContentPage>