-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
TimePickerDisabledStatesGallery.xaml
84 lines (75 loc) · 3.96 KB
/
TimePickerDisabledStatesGallery.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?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:windowsSpecific="clr-namespace:Xamarin.Forms.PlatformConfiguration.WindowsSpecific;assembly=Xamarin.Forms.Core"
xmlns:androidSpecific="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
xmlns:iosSpecific="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
x:Class="Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries.TimePickerDisabledStatesGallery"
Title="TimePicker Disabled States Gallery">
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="TimePicker" x:Key="CustomDisabledState">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="Red" />
<Setter Property="BackgroundColor" Value="Purple" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="TimePicker" x:Key="DefaultInInitialState">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="Green" />
<Setter Property="BackgroundColor" Value="Black" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<ScrollView VerticalOptions="Fill" HorizontalOptions="Fill">
<StackLayout>
<!-- Not using the VSM at all; should exhibit pre-VSM default behavior -->
<Label Text="The TimePicker below uses the current XF defaults; when IsEnabled is false, it uses the default native colors for the control. (Legacy Color Behavior)"/>
<TimePicker x:Name="Picker0" TextColor="Blue" BackgroundColor="Bisque" >
</TimePicker>
<Button Text="Toggle IsEnabled" x:Name="Button0" Clicked="Button0_OnClicked" />
<!-- Legacy Color Behavior turned off by the PlatformSpecific; ignores states entirely and uses
whatever colors are manually set for it -->
<Label Text="The TimePicker below has the Legacy Color Behavior disabled; it will stick with whatever colors are set, regardless of state"/>
<TimePicker x:Name="Picker1" TextColor="Blue" BackgroundColor="Bisque"
androidSpecific:VisualElement.IsLegacyColorModeEnabled="False"
windowsSpecific:VisualElement.IsLegacyColorModeEnabled="False"
iosSpecific:VisualElement.IsLegacyColorModeEnabled="False">
</TimePicker>
<Button Text="Toggle IsEnabled" x:Name="Button1" Clicked="Button1_OnClicked" />
<!-- Disabled colors fully managed by the VSM -->
<Label Text="The TimePicker below uses the VSM to customize the colors for the disabled state." />
<TimePicker x:Name="Picker2" Style="{StaticResource CustomDisabledState}" TextColor="Green"
BackgroundColor="Beige">
</TimePicker>
<Button Text="Toggle IsEnabled" x:Name="Button2" Clicked="Button2_OnClicked" />
<!-- This section verifies that the default color for a TimePicker's text is cached and can be reverted to -->
<Label Text="This TimePicker uses Color.Default for the intial text/background, and colors from the VSM when disabled."/>
<TimePicker x:Name="Picker3" Style="{StaticResource DefaultInInitialState}" TextColor="Default"
BackgroundColor="Default">
</TimePicker>
<Button Text="Toggle IsEnabled" x:Name="Button3" Clicked="Button3_OnClicked" />
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>