如何将枢轴标头放置在底部? [英] How place pivot header bottom?

查看:38
本文介绍了如何将枢轴标头放置在底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为,在UWP中应该可以将数据透视表头放置在底部.我阅读了,我们无需编辑模板就可以做到这一点.我找不到任何例子.

感谢您的回答

因此,只需将此样式用于 Pivot

 < Style x:Key ="PivotHeaderBottomStyle" TargetType ="Pivot">< Setter Property ="Margin" Value ="0"/>< Setter Property ="Padding" Value ="0"/>< Setter Property ="Background" Value ="Transparent"/>< Setter Property ="IsTabStop" Value ="False"/>< Setter Property ="ItemsPanel">< Setter.Value>< ItemsPanelTemplate>< Grid/></ItemsPanelTemplate></Setter.Value></Setter>< Setter Property ="Template">< Setter.Value>< ControlTemplate TargetType ="Pivot">< Grid x:Name ="RootElement"Background ="{TemplateBinding Background}"Horizo​​ntalAlignment ="{TemplateBinding Horizo​​ntalAlignment}"VerticalAlignment ="{TemplateBinding VerticalAlignment}">< Grid.Resources>< Style x:Key ="BaseContentControlStyle" TargetType ="ContentControl">< Setter Property ="FontFamily" Value ="XamlAutoFontFamily"/>< Setter Property ="FontWeight" Value ="SemiBold"/>< Setter Property ="FontSize" Value ="15"/>< Setter Property ="Template">< Setter.Value>< ControlTemplate TargetType ="ContentControl">< ContentPresenter ContentTemplate ="{TemplateBinding ContentTemplate}" ContentTransitions ="{TemplateBinding ContentTransitions}" Content ="{TemplateBinding Content}" Horizo​​ntalAlignment ="{TemplateBinding Horizo​​ntalContentAlignment}" Margin ="{TemplateBinding Padding}" OpticalMarginAlignment ="TrimSideBearings" VerticalAlignment ="{TemplateBinding VerticalContentAlignment}"/></ControlTemplate></Setter.Value></Setter></样式>< Style x:Key ="TitleContentControlStyle" BasedOn ="{StaticResource BaseContentControlStyle}" TargetType ="ContentControl">< Setter Property ="FontFamily" Value ="{ThemeResource PivotTitleFontFamily}"/>< Setter Property ="FontWeight" Value ="{ThemeResource PivotTitleThemeFontWeight}"/>< Setter Property ="FontSize" Value ="{ThemeResource PivotTitleFontSize}"/></样式></Grid.Resources>< Grid.RowDefinitions>< RowDefinition Height ="Auto"/>< RowDefinition Height ="*"/></Grid.RowDefinitions>< VisualStateManager.VisualStateGroups>< VisualStateGroup x:Name ="Orientation">< VisualState x:Name ="Portrait"><故事板>< ObjectAnimationUsingKeyFrames Storyboard.TargetProperty ="Margin" Storyboard.TargetName ="TitleContentControl">< DiscreteObjectKeyFrame KeyTime ="0" Value ="{ThemeResource PivotPortraitThemePadding}"/></ObjectAnimationUsingKeyFrames></Storyboard></VisualState>< VisualState x:Name ="Landscape"><故事板>< ObjectAnimationUsingKeyFrames Storyboard.TargetProperty ="Margin" Storyboard.TargetName ="TitleContentControl">< DiscreteObjectKeyFrame KeyTime ="0" Value ="{ThemeResource PivotLandscapeThemePadding}"/></ObjectAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup>< VisualStateGroup x:Name ="NavigationButtonsVisibility">< VisualState x:Name ="NavigationButtonsHidden"/>< VisualState x:Name ="NavigationButtonsVisible"><故事板>< 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"><故事板>< 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>< ContentControl x:Name ="TitleContentControl"ContentTemplate ="{TemplateBinding TitleTemplate}"Content ="{TemplateBinding标题}"IsTabStop ="False"Margin ="{StaticResource PivotPortraitThemePadding}"Style ="{StaticResource TitleContentControlStyle}"Visibility ="Collapsed"/>< Grid Grid.Row ="1">< Grid.Resources>< ControlTemplate x:Key ="NextTemplate" TargetType ="Button"><边界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"><故事板>< 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"><故事板>< 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;"Horizo​​ntalAlignment ="Center" MirroredWhenRightToLeft ="True" UseLayoutRounding ="False" VerticalAlignment ="Center"/></Border></ControlTemplate>< ControlTemplate x:Key ="PreviousTemplate" TargetType ="Button"><边界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"><故事板>< 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"><故事板>< 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;"Horizo​​ntalAlignment ="Center" MirroredWhenRightToLeft ="True" UseLayoutRounding ="False" VerticalAlignment ="Center"/></Border></ControlTemplate></Grid.Resources>< ScrollViewer x:Name ="ScrollViewer"BringIntoViewOnFocusChange ="False"Horizo​​ntalSnapPointsAlignment ="Center"Horizo​​ntalSnapPointsType ="MandatorySingle"Horizo​​ntalScrollBarVisibility =隐藏"Margin ="{TemplateBinding Padding}"Template ="{StaticResource ScrollViewerScrollBarlessTemplate}"VerticalSnapPointsType ="None"VerticalScrollBarVisibility =已禁用"VerticalScrollMode =已禁用"VerticalContentAlignment =拉伸"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 ="*"/>< RowDefinition Height ="Auto"/></Grid.RowDefinitions>< Grid.RenderTransform>< CompositeTransform x:Name ="PivotLayoutElementTranslateTransform"/></Grid.RenderTransform>< ContentPresenter x:Name ="LeftHeaderPresenter"ContentTemplate ="{TemplateBinding LeftHeaderTemplate}"Content ="{TemplateBinding LeftHeader}"Horizo​​ntalAlignment =拉伸"VerticalAlignment ="Stretch"/>< ContentControl x:Name ="HeaderClipper"Grid.Column ="1"Grid.Row ="1"Horizo​​ntalContentAlignment =拉伸"UseSystemFocusVisuals ="True">< ContentControl.Clip>< RectangleGeometry x:Name ="HeaderClipperGeometry"/></ContentControl.Clip>< Grid Background ="Transparent">< 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"背景=透明"Grid.Column ="1"Horizo​​ntalAlignment =左"Height ="36" IsTabStop ="False"Grid.Row ="1"IsEnabled ="False"Margin ="{ThemeResource PivotNavButtonMargin}"不透明度="0"Template ="{StaticResource PreviousTemplate}"UseSystemFocusVisuals ="False"VerticalAlignment =顶部"宽度="20"/>< Button x:Name ="NextButton"背景=透明"Grid.Column ="1"Horizo​​ntalAlignment =右"身高="36"IsTabStop ="False"IsEnabled ="False"Margin ="{ThemeResource PivotNavButtonMargin}"不透明度="0"Grid.Row ="1"Template ="{StaticResource NextTemplate}"UseSystemFocusVisuals ="False"VerticalAlignment =顶部"宽度="20"/>< ContentPresenter x:Name ="RightHeaderPresenter"ContentTemplate ="{TemplateBinding RightHeaderTemplate}"Content ="{TemplateBinding RightHeader}"Grid.Column ="2"Grid.Row ="1"Horizo​​ntalAlignment =拉伸"VerticalAlignment ="Stretch"/>< ItemsPresenter x:Name ="PivotItemPresenter"Grid.ColumnSpan ="3"Grid.Row ="0">< ItemsPresenter.RenderTransform>< TransformGroup>< TranslateTransform x:Name ="ItemsPresenterTranslateTransform"/>< CompositeTransform x:Name ="ItemsPresenterCompositeTransform"/></TransformGroup></ItemsPresenter.RenderTransform></ItemsPresenter></Grid></PivotPanel></ScrollViewer></Grid></Grid></ControlTemplate></Setter.Value></Setter></样式> 

和您的 Pivot 将是这样

I think, in UWP should be possible to place pivot header to bottom. I read, we can do this without template editing. I cannot find any example.

Thanks for answer

EDIT:

https://msdn.microsoft.com/en-us/library/windows/apps/dn997788.aspx?f=255&MSPPError=-2147217396

Header placement. Headers can be placed at the top or the bottom of the screen.

解决方案

If I understood you, default behavior like picture bellow

So, just use this Style for Pivot

    <Style x:Key="PivotHeaderBottomStyle" TargetType="Pivot">
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Grid/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Pivot">
                    <Grid x:Name="RootElement"
                          Background="{TemplateBinding Background}"
                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                          VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <Grid.Resources>
                            <Style x:Key="BaseContentControlStyle" TargetType="ContentControl">
                                <Setter Property="FontFamily" Value="XamlAutoFontFamily"/>
                                <Setter Property="FontWeight" Value="SemiBold"/>
                                <Setter Property="FontSize" Value="15"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ContentControl">
                                            <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" OpticalMarginAlignment="TrimSideBearings" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <Style x:Key="TitleContentControlStyle" BasedOn="{StaticResource BaseContentControlStyle}" TargetType="ContentControl">
                                <Setter Property="FontFamily" Value="{ThemeResource PivotTitleFontFamily}"/>
                                <Setter Property="FontWeight" Value="{ThemeResource PivotTitleThemeFontWeight}"/>
                                <Setter Property="FontSize" Value="{ThemeResource PivotTitleFontSize}"/>
                            </Style>
                        </Grid.Resources>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="Orientation">
                                <VisualState x:Name="Portrait">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="TitleContentControl">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotPortraitThemePadding}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Landscape">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="TitleContentControl">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotLandscapeThemePadding}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <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>
                        <ContentControl x:Name="TitleContentControl"
                                        ContentTemplate="{TemplateBinding TitleTemplate}"
                                        Content="{TemplateBinding Title}"
                                        IsTabStop="False" 
                                        Margin="{StaticResource PivotPortraitThemePadding}"
                                        Style="{StaticResource TitleContentControlStyle}"
                                        Visibility="Collapsed"/>
                        <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="*"/>
                                            <RowDefinition Height="Auto"/>
                                        </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"
                                                        Grid.Row="1"
                                                        HorizontalContentAlignment="Stretch"
                                                        UseSystemFocusVisuals="True">
                                            <ContentControl.Clip>
                                                <RectangleGeometry x:Name="HeaderClipperGeometry"/>
                                            </ContentControl.Clip>
                                            <Grid Background="Transparent">
                                                <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" 
                                                Grid.Row="1"
                                                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"
                                                Grid.Row="1"
                                                Template="{StaticResource NextTemplate}"
                                                UseSystemFocusVisuals="False"
                                                VerticalAlignment="Top"
                                                Width="20"/>
                                        <ContentPresenter x:Name="RightHeaderPresenter"
                                                          ContentTemplate="{TemplateBinding RightHeaderTemplate}"
                                                          Content="{TemplateBinding RightHeader}"
                                                          Grid.Column="2"
                                                          Grid.Row="1"
                                                          HorizontalAlignment="Stretch"
                                                          VerticalAlignment="Stretch"/>
                                        <ItemsPresenter x:Name="PivotItemPresenter"
                                                        Grid.ColumnSpan="3"
                                                        Grid.Row="0">
                                            <ItemsPresenter.RenderTransform>
                                                <TransformGroup>
                                                    <TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
                                                    <CompositeTransform x:Name="ItemsPresenterCompositeTransform"/>
                                                </TransformGroup>
                                            </ItemsPresenter.RenderTransform>
                                        </ItemsPresenter>
                                    </Grid>
                                </PivotPanel>
                            </ScrollViewer>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

and your Pivot will be like this

这篇关于如何将枢轴标头放置在底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆