Localizing Windows Phone App Bar

In the previous post, we talked about how to localize your windows phone application, which will grant you a double potential for it.

In this post, we will specifically state how to localize the app bar.

Adding an app bar, at the first place, could be done in two ways.

  1. adding it in the XAML page
  2. using C# in the page code-behind. However

But in spite of that; the XAML app bar doesn’t support dynamic data binding for the text label of the ApplicationBarIconButton or for the ApplicationBarMenuItem.

For this reason, the following code, along with calling it in the MainPage constructor and placeholder resources, are reproduced as commented samples in each relevant New Project template.

// Build 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.png", UriKind.Relative));
        appBarButton.Text = AppResources.AppBarButtonText;

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

This was simply how to localize the Application bar
For any feedback or questions, you’re more than welcome to send me an email atyasmine.abdelhady@hotmail.com or reach me @yasabdelhady on twitter.

Privacy Policy

This page provides the privacy policy of the app and how we use your data.

The privacy of the user is much valued and since there is no need to collect information, this app does not collect, store or share any personal information or information related to your device.