.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Home >> Articles >> Windows Phone >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Application Bar in Windows Phone 8

Posted By:Karthikeyan Anbarasan       Posted Date: January 31, 2013    Points: 200    Category: Windows Phone    URL: http://www.dotnetspark.com  

In this article we will see how to use the Application Bar in Windows Phone 8 Application development.


In this article we are going to see how to use the Application Bar in a Windows Phone 8 Application development, we don't see much of the changes from the existing version of the Windows Phone SDK but still we will have a quick look on the Application Bar on how exactly it occupies the new hardware. First let us see what is an Application Bar is all about, Application Bar is a row of Individual set of buttons that are inside an ellipsis on the phone screen. The user can make use of this set of buttons to navigate and do some user activities that are necessary for the application which is user friendly and easily accessible. Application bar also has a set of options which are Menu items which can be used as a menu on demand by click on the . button at the right side of the Application Bar.

Let us see a step by step approach on how to use this Application bar in a Windows Phone 8 application development.


Open Visual Studio 2012 IDE in an administrator mode (Right Click and select Run as an Administrator) and select File à New Project to select Windows Phone application development template that is available under the Windows Phone tab in the left menu as shown in the screen below.

Click on OK and we can see a small popup wizard asking for the version of the framework we are going to target, select Windows Phone 8 and click on OK to proceed further. We can see the project is created and list of default files and folders will be added to the Solution which can be seen in the Solution Explorer as shown in the screen below.

In the previous version of the Windows Phone which is Version 7.5 we can see the Application Bar code will be available in the XAML code base itself, now in this newer version we need to go to the code behind, i.e. Main Page. Xaml. Cs and we can see the commented code which has the application Bar code base which is localized as shown in the screen below.

Uncomment the code which is basically a function called BuildLocalizedApplicationBar and a calling location in the Mainpage constructor. Uncomment both the places and we can see the code base as shown in the screen below.

C# Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using AppBarSample.Resources;

namespace AppBarSample
    public partial class MainPage : PhoneApplicationPage
        // Constructor
        public MainPage()

            // Sample code to localize the ApplicationBar

        // Sample code for building a localized ApplicationBar
        private void BuildLocalizedApplicationBar()
            // Set the page's ApplicationBar to a new instance of ApplicationBar.
            ApplicationBar = new ApplicationBar();

            // Create a new button and set the text value to the localized string from AppResources.
            ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
            appBarButton.Text = AppResources.AppBarButtonText;

            // Create a new menu item with the localized string from AppResources.
            ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);

Now build and execute the application and we can see the Application bar added to the base of the page with the default buttons as shown in the screen below. So to build and execute select the Emulator WVGA 512 MB option for the latest feature check as shown in the screen below.

At the bottom of the screen we can see the button Add and the Menu item which is added, as we removed the commented section of the Application bar in the Main Page. XAML. Cs page in the above steps. We can customize it further to make changes accordingly to the requirement to have a good list of menus and buttons.


So in this article we have seen how to use the Application Bar in Windows Phone 8 Application development.

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend