简体   繁体   中英

how to localize a application bar in wp7?

is it possible to localize the application bar?

i made the tutorial on msdn how to localize a application and everything was find. but the method with:

{Binding Localizedresources.Today, Mode=OneWay}

dont work on the app. bar

what can i do?

If you don't want to use a 3rd party solution like James Cadd suggested, you may create the application bar from your code-behind and using your resources to fill-in the Text-property:

public MainPage() {
  InitializeComponent();
  Loaded += MainPage_Loaded;
}

void MainPage_Loaded(object sender, RoutedEventArgs e) {
  BuildApplicationBar();
}

private void BuildApplicationBar() {
  ApplicationBar = new ApplicationBar();

  var appBarButtonAdd = new ApplicationBarIconButton(new Uri("/img/add.png", UriKind.Relative)) { Text = AppResources.ABAdd };
  appBarButtonAdd.Click += newEntry_Click;
  ApplicationBar.Buttons.Add(appBarButtonAdd);

  var appBarMenuReview = new ApplicationBarMenuItem(AppResources.ABMarketplace);
  appBarMenuReview.Click += review_Click;
  ApplicationBar.MenuItems.Add(appBarMenuReview);
}

You haven't included much to work with, but I wrote a pretty good (I think) blog on the subject, including code from start to finish on localizing an app. It covers localization from start to finish, with screenshots and downloadable code, including the application bar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM