-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathStatusBarBehaviorPage.xaml
More file actions
182 lines (165 loc) · 7.32 KB
/
StatusBarBehaviorPage.xaml
File metadata and controls
182 lines (165 loc) · 7.32 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?xml version="1.0" encoding="utf-8"?>
<pages:BasePage
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.StatusBarBehaviorPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
ios:Page.UseSafeArea="True"
Title="StatusBarBehavior"
x:DataType="vm:StatusBarBehaviorViewModel"
x:TypeArguments="vm:StatusBarBehaviorViewModel"
x:Name="Page">
<ContentPage.Resources>
<ControlTemplate x:Key="RadioButtonTemplate">
<Border Stroke="#F3F2F1"
StrokeThickness="2"
StrokeShape="RoundRectangle 10"
BackgroundColor="#F3F2F1"
HeightRequest="90"
WidthRequest="90"
HorizontalOptions="Start"
VerticalOptions="Start">
<VisualStateManager.VisualStateGroups>
<VisualStateGroupList>
<VisualStateGroup x:Name="CheckedStates">
<VisualState x:Name="Checked">
<VisualState.Setters>
<Setter TargetName="check"
Property="Opacity"
Value="1" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Unchecked">
<VisualState.Setters>
<Setter TargetName="check"
Property="Opacity"
Value="0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</VisualStateManager.VisualStateGroups>
<Grid Margin="4"
WidthRequest="90"
BackgroundColor="Transparent">
<Grid Margin="0,0,4,0"
WidthRequest="18"
HeightRequest="18"
HorizontalOptions="End"
VerticalOptions="Start">
<Ellipse Stroke="Blue"
Fill="White"
WidthRequest="16"
HeightRequest="16"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Ellipse x:Name="check"
Fill="Blue"
WidthRequest="8"
HeightRequest="8"
HorizontalOptions="Center"
VerticalOptions="Center" />
</Grid>
<ContentPresenter />
</Grid>
</Border>
</ControlTemplate>
<Style TargetType="RadioButton">
<Setter Property="ControlTemplate" Value="{StaticResource RadioButtonTemplate}" />
</Style>
</ContentPage.Resources>
<Page.Behaviors>
<mct:StatusBarBehavior
BindingContext="{Binding Path=BindingContext, Source={x:Reference Page}, x:DataType=ContentPage}"
StatusBarColor="{Binding StatusBarColor}"
StatusBarStyle="{Binding StatusBarStyle}" />
</Page.Behaviors>
<ScrollView Padding="{StaticResource ContentPadding}">
<VerticalStackLayout Padding="15,0" Spacing="30" IgnoreSafeArea="False">
<Label Text="Slide to change StatusBar color" />
<Label Text="Red" />
<Slider
Margin="20,0"
Maximum="1"
MaximumTrackColor="Red"
Minimum="0"
MinimumTrackColor="Red"
ThumbColor="Red"
Value="{Binding RedSliderValue}" />
<Label Text="Green" />
<Slider
Margin="20,0"
Maximum="1"
MaximumTrackColor="Green"
Minimum="0"
MinimumTrackColor="Green"
ThumbColor="Green"
Value="{Binding GreenSliderValue}" />
<Label Text="Blue" />
<Slider
Margin="20,0"
Maximum="1"
MaximumTrackColor="Blue"
Minimum="0"
MinimumTrackColor="Blue"
ThumbColor="Blue"
Value="{Binding BlueSliderValue}" />
<HorizontalStackLayout>
<Label Text="Alpha: " />
<Label Text="{Binding AlphaSliderValue}" />
</HorizontalStackLayout>
<Stepper
HorizontalOptions="Start"
Margin="20,0"
Maximum="1"
Increment="0.1"
Minimum="0"
Value="{Binding AlphaSliderValue}" />
<Label Text="Select StatusBar and NavigationBar style" />
<HorizontalStackLayout Spacing="15">
<RadioButton IsChecked="{Binding IsDefaultChecked}"
VerticalOptions="Center">
<RadioButton.Content>
<Label
Margin="10,0,0,0"
Text="Default"
VerticalOptions="Center"
VerticalTextAlignment="Center" />
</RadioButton.Content>
</RadioButton>
<RadioButton IsChecked="{Binding IsLightContentChecked}"
VerticalOptions="Center">
<RadioButton.Content>
<Label
Margin="10,0,0,0"
Text="Light Content"
VerticalOptions="Center"
VerticalTextAlignment="Center" />
</RadioButton.Content>
</RadioButton>
<RadioButton IsChecked="{Binding IsDarkContentChecked}"
VerticalOptions="Center">
<RadioButton.Content>
<Label
Margin="10,0,0,0"
Text="Dark Content"
VerticalOptions="Center"
VerticalTextAlignment="Center" />
</RadioButton.Content>
</RadioButton>
</HorizontalStackLayout>
<Button
x:Name="ModalPageButton"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Button
Clicked="OnBrokenShellButtonClicked"
HorizontalOptions="Center"
Text="Go to Broken Shell.TitleView"
VerticalOptions="Center" />
</VerticalStackLayout>
</ScrollView>
</pages:BasePage>