方向上的白色间隙!=纵向平坦

时间:2017-01-29 15:53:34

标签: c# xaml uwp win-universal-app windows-10-universal

当移动设备方向向左或向右旋转时,我的UWP应用会显示白色间隙。enter image description here

我的XAML:

<prismMvvm:SessionStateAwarePage>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>
    <ListBox Grid.Row="0" x:Name="VideoItemsListBox">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
        <ListBox.ItemTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding title}" />
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
    <MediaElement x:Name="VideoPlayer" Grid.Row="1">
    </MediaElement>
</Grid>

我是否需要实施一些措施来消除这种差距?我怎样才能解决这个问题?

1 个答案:

答案 0 :(得分:1)

好像条纹是状态栏。 Hide the status bar如下所示可以解决您的问题。

public RemoveGap()
{
   this.InitializeComponent(); 
   if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
   {
       StatusBar.GetForCurrentView().HideAsync();  
   }
}

注意,要使用此课程,我们需要添加移动特殊参考,如下图所示:enter image description here