summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.UAP/TabbedPageStyle.xaml
blob: cac1045d419bd32da1e02517278a1364e644a5d2 (plain)
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
183
184
185
186
187
188
189
190
191
192
193
194
<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:uwp="using:Xamarin.Forms.Platform.UWP">
	<Style x:Key="TabbedPageStyle" TargetType="uwp:FormsPivot">
		<Setter Property="HeaderTemplate">
			<Setter.Value>
				<DataTemplate>
					<TextBlock Name="TabbedPageHeaderTextBlock" Text="{Binding Title}" Style="{ThemeResource BodyTextBlockStyle}" />
				</DataTemplate>
			</Setter.Value>
		</Setter>

		<Setter Property="ItemTemplate">
			<Setter.Value>
				<DataTemplate>
					<uwp:FormsPresenter Content="{Binding}" ContentTemplate="{ThemeResource ContainedPageTemplate}" />
				</DataTemplate>
			</Setter.Value>
		</Setter>

		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="uwp:FormsPivot">
					<Grid x:Name="RootElement" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
						
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto"/>
							<RowDefinition Height="*"/>
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="NavigationButtonsVisibility">
								<VisualState x:Name="NavigationButtonsHidden"/>
								<VisualState x:Name="NavigationButtonsVisible">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="NextButton">
											<DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsEnabled" Storyboard.TargetName="NextButton">
											<DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PreviousButton">
											<DiscreteObjectKeyFrame KeyTime="0" Value="1"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsEnabled" Storyboard.TargetName="PreviousButton">
											<DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="HeaderStates">
								<VisualState x:Name="HeaderDynamic"/>
								<VisualState x:Name="HeaderStatic">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Header">
											<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="StaticHeader">
											<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>

                        <Border x:Name="TopCommandBarArea" HorizontalAlignment="Stretch" Background="{TemplateBinding ToolbarBackground}">
                            <uwp:FormsCommandBar x:Name="CommandBar" Background="{TemplateBinding ToolbarBackground}" MinHeight="{ThemeResource TitleBarHeight}">
                                <uwp:FormsCommandBar.Content>
                                    <Border x:Name="TitleArea" Visibility="{TemplateBinding TitleVisibility}" Height="{ThemeResource TitleBarHeight}">
                                        <TextBlock Text="{TemplateBinding Title}" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="{TemplateBinding ToolbarForeground}" Style="{ThemeResource TitleTextBlockStyle}" />
                                    </Border>
                                </uwp:FormsCommandBar.Content>
                            </uwp:FormsCommandBar>
                        </Border>

                        <Grid Grid.Row="1">
							<Grid.Resources>
								<ControlTemplate x:Key="NextTemplate" TargetType="Button">
									<Border x:Name="Root" BorderBrush="{ThemeResource SystemControlForegroundTransparentBrush}" BorderThickness="{ThemeResource PivotNavButtonBorderThemeThickness}" Background="{ThemeResource SystemControlBackgroundBaseMediumLowBrush}">
										<VisualStateManager.VisualStateGroups>
											<VisualStateGroup x:Name="CommonStates">
												<VisualState x:Name="Normal"/>
												<VisualState x:Name="PointerOver">
													<Storyboard>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Root">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}"/>
														</ObjectAnimationUsingKeyFrames>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Arrow">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltMediumHighBrush}"/>
														</ObjectAnimationUsingKeyFrames>
													</Storyboard>
												</VisualState>
												<VisualState x:Name="Pressed">
													<Storyboard>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Root">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumHighBrush}"/>
														</ObjectAnimationUsingKeyFrames>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Arrow">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltMediumHighBrush}"/>
														</ObjectAnimationUsingKeyFrames>
													</Storyboard>
												</VisualState>
											</VisualStateGroup>
										</VisualStateManager.VisualStateGroups>
										<FontIcon x:Name="Arrow" Foreground="{ThemeResource SystemControlForegroundAltMediumHighBrush}" FontSize="12" FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="&#xE0E3;" HorizontalAlignment="Center" MirroredWhenRightToLeft="True" UseLayoutRounding="False" VerticalAlignment="Center"/>
									</Border>
								</ControlTemplate>
								<ControlTemplate x:Key="PreviousTemplate" TargetType="Button">
									<Border x:Name="Root" BorderBrush="{ThemeResource SystemControlForegroundTransparentBrush}" BorderThickness="{ThemeResource PivotNavButtonBorderThemeThickness}" Background="{ThemeResource SystemControlBackgroundBaseMediumLowBrush}">
										<VisualStateManager.VisualStateGroups>
											<VisualStateGroup x:Name="CommonStates">
												<VisualState x:Name="Normal"/>
												<VisualState x:Name="PointerOver">
													<Storyboard>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Root">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}"/>
														</ObjectAnimationUsingKeyFrames>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Arrow">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltMediumHighBrush}"/>
														</ObjectAnimationUsingKeyFrames>
													</Storyboard>
												</VisualState>
												<VisualState x:Name="Pressed">
													<Storyboard>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Root">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumHighBrush}"/>
														</ObjectAnimationUsingKeyFrames>
														<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Arrow">
															<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltAltMediumHighBrush}"/>
														</ObjectAnimationUsingKeyFrames>
													</Storyboard>
												</VisualState>
											</VisualStateGroup>
										</VisualStateManager.VisualStateGroups>
										<FontIcon x:Name="Arrow" Foreground="{ThemeResource SystemControlForegroundAltMediumHighBrush}" FontSize="12" FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="&#xE0E2;" HorizontalAlignment="Center" MirroredWhenRightToLeft="True" UseLayoutRounding="False" VerticalAlignment="Center"/>
									</Border>
								</ControlTemplate>
							</Grid.Resources>
							<ScrollViewer x:Name="ScrollViewer" BringIntoViewOnFocusChange="False" HorizontalSnapPointsAlignment="Center" HorizontalSnapPointsType="MandatorySingle" HorizontalScrollBarVisibility="Hidden" Margin="{TemplateBinding Padding}" Template="{StaticResource ScrollViewerScrollBarlessTemplate}" VerticalSnapPointsType="None" VerticalScrollBarVisibility="Disabled" VerticalScrollMode="Disabled" VerticalContentAlignment="Stretch" ZoomMode="Disabled">
								<PivotPanel x:Name="Panel" VerticalAlignment="Stretch">
									<Grid x:Name="PivotLayoutElement">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto"/>
											<ColumnDefinition Width="*"/>
											<ColumnDefinition Width="Auto"/>
										</Grid.ColumnDefinitions>
										<Grid.RowDefinitions>
											<RowDefinition Height="Auto"/>
											<RowDefinition Height="*"/>
										</Grid.RowDefinitions>
										<Grid.RenderTransform>
											<CompositeTransform x:Name="PivotLayoutElementTranslateTransform"/>
										</Grid.RenderTransform>
										<ContentPresenter x:Name="LeftHeaderPresenter" ContentTemplate="{TemplateBinding LeftHeaderTemplate}" Content="{TemplateBinding LeftHeader}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
										<ContentControl x:Name="HeaderClipper" Grid.Column="1" HorizontalContentAlignment="Stretch" UseSystemFocusVisuals="True">
											<ContentControl.Clip>
												<RectangleGeometry x:Name="HeaderClipperGeometry"/>
											</ContentControl.Clip>
											<Grid Name="TabbedPageHeaderGrid" Background="{TemplateBinding ToolbarBackground}">
												<PivotHeaderPanel x:Name="StaticHeader" Visibility="Collapsed"/>
												<PivotHeaderPanel x:Name="Header">
													<PivotHeaderPanel.RenderTransform>
														<TransformGroup>
															<CompositeTransform x:Name="HeaderTranslateTransform"/>
															<CompositeTransform x:Name="HeaderOffsetTranslateTransform"/>
														</TransformGroup>
													</PivotHeaderPanel.RenderTransform>
												</PivotHeaderPanel>
											</Grid>
										</ContentControl>
										<Button x:Name="PreviousButton" Background="Transparent" Grid.Column="1" HorizontalAlignment="Left" Height="36" IsTabStop="False" IsEnabled="False" Margin="{ThemeResource PivotNavButtonMargin}" Opacity="0" Template="{StaticResource PreviousTemplate}" UseSystemFocusVisuals="False" VerticalAlignment="Top" Width="20"/>
										<Button x:Name="NextButton" Background="Transparent" Grid.Column="1" HorizontalAlignment="Right" Height="36" IsTabStop="False" IsEnabled="False" Margin="{ThemeResource PivotNavButtonMargin}" Opacity="0" Template="{StaticResource NextTemplate}" UseSystemFocusVisuals="False" VerticalAlignment="Top" Width="20"/>
										<ContentPresenter x:Name="RightHeaderPresenter" ContentTemplate="{TemplateBinding RightHeaderTemplate}" Content="{TemplateBinding RightHeader}" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
										<ItemsPresenter x:Name="PivotItemPresenter" Grid.ColumnSpan="3" Grid.Row="1">
											<ItemsPresenter.RenderTransform>
												<TransformGroup>
													<TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
													<CompositeTransform x:Name="ItemsPresenterCompositeTransform"/>
												</TransformGroup>
											</ItemsPresenter.RenderTransform>
										</ItemsPresenter>
									</Grid>
								</PivotPanel>
							</ScrollViewer>
						</Grid>

						<Border x:Name="BottomCommandBarArea" Grid.Row="2" HorizontalAlignment="Stretch"></Border>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>