App. XAML:
<Application. Resources>
<Shell: ApplicationBar X: Key ="Mainappbar"Isvisible =" true ">
<Shell: ApplicationBar. menuitems>
<Shell: applicationbarmenuitem text = "about" Click ="Applicationbarabout_click"> </Shell: applicationbarmenuitem>
</Shell: ApplicationBar. menuitems>
<Shell: ApplicationBar. Buttons>
<Shell: applicationbariconbutton text = "Web" iconuri?”ie_icon.png "Click ="Applicationbariconwebbrowserbutton_click"> </Shell: applicationbariconbutton>
<Shell: applicationbariconbutton text = "Images" iconuri?#pictures_icon.png "Click ="Applicationbariconpictures_click"> </Shell: applicationbariconbutton>
</Shell: ApplicationBar. Buttons>
</Shell: ApplicationBar>
</Application. Resources>
App. XAML. CS: The writing method is generic. When you enter any page, click the ApplicationBar button to execute the code.
Private void applicationbariconwebbrowserbutton_click (Object sender, eventargs E)
{
Phoneapplicationframe root = application. Current. rootvisual as phoneapplicationframe;
Root. navigate (New uri ("/webbrowser/www.bin.com", urikind. Relative ));
}
Private void applicationbariconpictures_click (Object sender, eventargs E)
{
Phoneapplicationframe root = application. Current. rootvisual as phoneapplicationframe;
Root. navigate (New uri ("/pictures", urikind. Relative ));
}
Private void applicationbarabout_click (Object sender, eventargs E)
{
Phoneapplicationframe root = application. Current. rootvisual as phoneapplicationframe;
Root. navigate (New uri ("/about", urikind. Relative ));
}
Mainpage. XAML:
<Phone: phoneapplicationpage ApplicationBar = "{staticresourceMainappbar} ">