【问题标题】:White gap on orientation != portrait flat方向上的白色间隙!=纵向平面
【发布时间】:2017-01-29 15:53:34
【问题描述】:

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

我的 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>

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

【问题讨论】:

  • 列表框中显示了什么?我没有看到定义的数据模板
  • 我编辑了 xaml 代码。
  • 如果你改变了列表框的背景颜色,白色的补丁会改变颜色吗?
  • 一些全屏选项呢?

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


【解决方案1】:

似乎条纹是用于状态栏的。 Hide the status bar 如下所示可能会解决您的问题。

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

注意,要使用这个类,我们需要添加一个移动专用引用,如下图所示:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-21
    • 1970-01-01
    相关资源
    最近更新 更多