0

我试图在我的通用 10 应用程序中居中枢轴标题,我的代码是这样的:

 <Pivot>
    <PivotItem x:Name="pivot0" Margin="0">
        <PivotItem.Header >
           <Image x:Name="headerimg" Source="images/1.png"  PointerExited="pointerExited" Height="40" Stretch="Uniform" PointerMoved="headerimg_PointerMoved" />
        </PivotItem.Header>
        <Grid >

        </Grid>
    </PivotItem>

    <PivotItem>
       <PivotItem.Header>
           <Image x:Name="headerimg1" Source="images/2.png"  Height="40" Stretch="Uniform" PointerExited="headerimg1_PointerExited" PointerMoved="headerimg1_PointerMoved" />
       </PivotItem.Header>
       <Grid>
          <TextBlock Text="test3"></TextBlock>
       </Grid>
    </PivotItem>
</Pivot>

我有一个使用标题模板的想法,但我不知道如何使数据透视标题居中,谢谢帮助

4

1 回答 1

3

在此处查看有关如何执行此操作的完整示例:https ://blog.hompus.nl/2015/09/04/responsive-pivot-headers-in-universal-windows-platform-apps/

进口零件是

  • 设置 Horizo​​ntalContentAllignment 以获得居中 ><Setter Target="HeaderClipper.HorizontalContentAlignment" Value="Center" />
  • 注意枢轴标题的错误默认高度!默认模板的高度设置为 48,在大多数情况下这还不够!
于 2015-12-16T22:43:39.797 回答