如何在PivotItem中获取全宽

Den*_*elt 5 xaml pivotviewer windows-phone

在XAML中,PivotItems在Windows Phone上没有完整的屏幕宽度.这是一个很好的行为和设计,但对于单个图像,我希望它填满整个屏幕宽度.

这可以实现吗?

小智 8

根本原因是默认PivotItemMargin设置为12,0,12,0.我们可以在generic.xaml中找到该设置.

所以我们需要做的是覆盖App.xaml中的设置.像这样:
<Thickness x:Key="PivotItemMargin">0</Thickness>


Den*_*elt 5

这是解决方案,具有负余量

<controls:Pivot>
    <controls:PivotItem Margin="-10,0,-10,0">
        <Grid />
    </controls:PivotItem>

    <controls:PivotItem Margin="-10,0,-10,0">
        <Grid />
    </controls:PivotItem>
</controls:Pivot>
Run Code Online (Sandbox Code Playgroud)

当然,您也可以使用常规轴,只将图像边距设置为-10,0,-10,0