【发布时间】:2017-01-12 01:51:46
【问题描述】:
我尝试使用 Page.BottomAppBar 创建 shell。结果是该栏可见,但 MainPage 的内容不可见,仅显示黑屏。
public override Task OnInitializeAsync(IActivatedEventArgs args)
{
Window.Current.Content = new Views.ShellNavBar();
return Task.CompletedTask;
}
这是 ShellNavBar 页面:
<Page
/.../
<Page.BottomAppBar>
<CommandBar>
<AppBarSeparator/>
<AppBarButton Icon="Add" Label="Add" Click="AppBarAddButton_Click" />
<AppBarButton Icon="Home" Label="Home" Click="AppBarHomeButton_Click" />
<CommandBar.Content>
<TextBlock x:Name="HeadText" Text="PlaceHolder" Margin="12,14"/>
</CommandBar.Content>
</CommandBar>
</Page.BottomAppBar>
</Page>
有人可以指导我在哪里做错了吗?
【问题讨论】:
-
我已经测试了你的代码。它在我的解决方案中运行良好。你能给我提供更多关于你的主页 xaml 代码的细节吗。
-
嗨。这只是一个简单的页面。页眉和文本块。来自主页构造函数的调试消息显示调用了 onStartAsync 中的导航,但屏幕为黑色。如果我将外壳从模板更改回原始汉堡菜单,一切正常。
-
你的意思是背景颜色的开头是默认的。
标签: uwp template10