问题
I have the following xaml
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Frame Height="Auto" Width="200" Background="Green" />
</StackPanel>
<Pivot Grid.Row="1" Background="Red" Width="200" VerticalAlignment="Stretch" Title="Pivot Title">
<PivotItem Header="Blah">
<TextBlock Text="Pivot content"/>
</PivotItem>
</Pivot>
</Grid>
Which produces the following layout

The issue is that the pivot is appearing above where I would think it logically should appear. The pivot should appear below the half way mark but instead it is appearing about 27 pixels above it. I can of course just add a top margin to the pivot to push it back down but I'd like to get to the bottom of why it's appearing up there in the first place.
回答1:
The cause of that problem is that vertical margin of Pivot
depends on bounds mode of status bar, as Pivot
is intented to be the only child element of a page. If your bounds mode is set to UseVisible
and your status bar is visible, then pivot's vertical margin will be negative (about -20, I think). So, if you add this code to the constructor:
ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
There'll be no vertical margin at all, and you will have expected behavior:

来源:https://stackoverflow.com/questions/25678324/windows-phone-pivot-displaying-above-where-it-should