Xaml NavigationView.Content中不需要的边距
我做了一个简单的应用程序,什么都不做。它主要显示一个NavigationView,其中包含两个项目和一个文本块作为其内容。代码如下:Xaml NavigationView.Content中不需要的边距,xaml,uwp,uwp-xaml,navigationview,Xaml,Uwp,Uwp Xaml,Navigationview,我做了一个简单的应用程序,什么都不做。它主要显示一个NavigationView,其中包含两个项目和一个文本块作为其内容。代码如下: <Page x:Class="test.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="
<Page
x:Class="test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:test"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<NavigationView>
<NavigationView.MenuItems>
<NavigationViewItem Content="First Item" />
<NavigationViewItem Content="Second Item" />
</NavigationView.MenuItems>
<TextBlock Style="{StaticResource HeaderTextBlockStyle}" Text="Welcome to my Page"/>
</NavigationView>
</Grid>
</Page>
我的应用程序如下所示:
为什么文本块顶部有额外的空间?如何移除该空间?我知道这是可能的,因为新闻应用程序使用NavigationView,并且没有垂直边距。以下是它的截图:
您需要将
AlwaysShowHeader
属性设置为False:
<NavigationView AlwaysShowHeader="False">
这在中被调用,但当前似乎改变了此行为,默认情况下不显示任何标题。我刚刚在第9频道上看到了此视频。非常感谢。