Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obtain full width in PivotItem

In XAML, PivotItems don't have full width of the screen on a Windows Phone. This is good behavior and design, but for a single image I want it to fill the entire screenwidth.

Can this be accomplished?

like image 826
Dennis van der Stelt Avatar asked Sep 05 '13 09:09

Dennis van der Stelt


2 Answers

The root cause is that default PivotItemMargin is set to 12,0,12,0. We can find the setting in generic.xaml.

So what we need to do is overridding the setting in App.xaml. Just like this:
<Thickness x:Key="PivotItemMargin">0</Thickness>

like image 170
Plex Avatar answered Sep 21 '22 06:09

Plex


This is the solution, having a negative margin

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

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

Of course you can also use a regular pivot and only have the image margin set to -10,0,-10,0

like image 5
Dennis van der Stelt Avatar answered Sep 22 '22 06:09

Dennis van der Stelt