2016-12-29 55 views
2

我嘗試使用Page.BottomAppBar創建外殼。結果是欄可見,但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> 

有人能指導我在哪裏,我在做錯誤?

+0

我已經測試你的code.It在我solution.can您提供正常工作我有關你主頁xaml代碼的更多細節。 –

+0

嗨。這只是簡單的頁面。頁面頭和文本塊。來自主頁面構造函數的調試消息顯示onStartAsync中的導航被調用,但屏幕是黑色的。如果我將shell從模板更改回原始漢堡菜單,則everyhing工作正常。 – matthew6870

+0

你的意思是背景顏色的開始是默認的。 –

回答

0

好吧,我將你的代碼添加到模板,看看它是否會工作,並確實如此。甚至不會阻塞任何漢堡菜單。我不確定你的問題是什麼,我想你可能有一個錯字或什麼,因爲你的方法很好。

這裏是我的app.xaml.cs代碼:

enter image description here

感謝您使用模板10