Jimmy Engström


translating an application bar in wp7

When using the Applicationbar in WP7 I noticed that it can’t be translated like all the other controls.

Therefore I built a simple helper class to help with the translations.

The usage is simple, just add the translations in a resource file (like you normally would) and then set the text property on the buttons or menu items to the name in the resource file.
Change the access modifier to public.

The Resources:


The xaml:



Now in the page loaded event add:
.LocalizeAppBar(new  AppResource (), ApplicationBar);

Your application bar will now be automagically translated.

Update 2011-09-30
Found a small bug where “No Translation” was shown the second time the page was shown (and the translation was already done).
I have updated the sample code to fix that problem.

AppbarHelperSample.zip (79.13 kb)

Posted in Windows Phone with :