方向上的白色间隙!=纵向平面
White gap on orientation != portrait flat
当移动设备方向向左或向右旋转时,我的 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>
我需要实施一些措施来消除差距吗?我怎样才能解决这个问题?
条纹好像是用来做状态栏的。 Hide the status bar像下面这样可能会解决您的问题。
public RemoveGap()
{
this.InitializeComponent();
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
StatusBar.GetForCurrentView().HideAsync();
}
}
注意,要使用这个class,我们需要添加一个移动专用参考,如下图所示:
当移动设备方向向左或向右旋转时,我的 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>
我需要实施一些措施来消除差距吗?我怎样才能解决这个问题?
条纹好像是用来做状态栏的。 Hide the status bar像下面这样可能会解决您的问题。
public RemoveGap()
{
this.InitializeComponent();
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
StatusBar.GetForCurrentView().HideAsync();
}
}
注意,要使用这个class,我们需要添加一个移动专用参考,如下图所示: