c# - Global App bar on windows 8 application -
I am working on a Windows 8 application project I am using Visual Studio 2012 and this is the predefined templates (Gruped Page, Split Page, Ipspages). I need to add an app bar at this time. The way I choose, I create one and display it on all pages. I read this article:
To add it to my project, I set the global page as the start page on App.xaml
Protected async override zero on-launch (launch activeAgentArgrs ElGs) ... if! (! Rootframe.Navigate (Typf (GlobalPage), RG.Argems)) New exception throw ("Failed to create initial page"); ... On the global page, I'm changing the method on-line to reach the main home page:
rootPage = e Page in the form of. Frame 1 Navigate (typef (menopause), this); I add event membership for the button, such as
Private Zero ButtonBlost_Link (Object Sender, Routing Avenger, ARGS E) {this.Frame.Navigate ( Typeof (BlogListManagement), this); } After launching the app, the app bar is displayed, and I can navigate with the app button inside, but after the first navigation, AppBar does not appear on the target page. is.
Any thoughts of my mistake?
Thank you for your help.
What you want to do is set the app to the Layout Aware page because all the pages from that page Got out For the content of AppBar, you may want to use a UserControl for ease of coding and style.
First create UserControl:
& lt; UserControl x: Class = "AppBarGlobal .AppbarContent" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/ 2006 / xaml "xmlns: local =" using: AppBarGlobal "xmlns: d =" http://schemas.microsoft.com/expression/blend/2008 "xmlns: mc =" http://schemas.openxmlformats.org / Markup-compatibility / 2006 "MC: Ignorable =" D "D: Design Hight =" 300 "D: DesignWidth =" 400 "& gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Button content = "1" style = "{StaticResource AppBarButtonStyle}" /> & Lt; Button content = "2" style = "{StaticResource AppBarButtonStyle}" /> & Lt; / StackPanel & gt; & Lt; / UserControl & gt; And then in the constructor of LayoutAwarePage, you want to create AppBar, set the content to UserControl, and add it to your Buttom or TopAppBar page - in this sample I use BottomAppBar and Set anything in consturctor, such as:
public layoutswire page () {bar = new appBar (); times. Content = new AppbarContent (); This.BottomAppBar = Bar; // and then the remaining code for the constructor. This should allow the Global App Bar inside your Windows Store app on all pages you receive from Layout Aware Page.
Comments
Post a Comment