You want to share your AppBar across multiple pages. Unfortunately, in Windows Store apps it is not possible using referencing AppBar defined in App.xaml using StaticResource as is the case of Windows Phone. There are 2 ways how to do it:
- Create another Frame inside your main page and do all navigation in this frame. Check this MSDN article.
- Create UserControl with contents (buttons) of your AppBar, add TopAppBar on every page and set its content to that UserControl. This approach is advised in this StackOverflow answer.
I might see little problem with page navigation. If you want to navigate the hosting frame from the UserControl, store the Frame instance which is created in the App.xaml.cs OnActivated method to some static property of App class. For example public static Frame RootFrame { get; private set; }
and set it by App.RootFrame = new Frame()
. To navigate from the code behind your UserControl just call something like this: App.RootFrame.Navigate()
.
This approach was advised by Filip Skakun here on StackOverflow.