Windows Phone development: Localizing an application bar

Source: Internet
Author: User

Create a localized applicationProgramAdd multi-language support for the Application bar.

We know that the text attribute of ApplicationBar in Windows Phone is not a dependency attribute and cannot be bound to internationalize the text. So how can we implement the multi-language text of ApplicationBar in actual development? There are several methods: 1. AfterCodeGenerate An appbar, and use the resource file in text. This method is the simplest method, that is, translating the XAML code into the C # code. One of the advantages is that the text can be internationalized. 2. Use static Resources This method is similar to a style, that is, the form of text = {"staticresource appbar_save.

 

Before practicing this demo, you 'd better take a look at Windows Phone application globalization. Some specific details are not mentioned in this article.

The general interface is as follows. For convenience, after we change the language of the current environment, the language resources will be reloaded after we navigate to another page.

Note: The interface language is only available inInitializecomponent will be reloaded

 

First, let's take a look at the implementation method of the post code:

 

Set the text attribute in the code. What is appresource? -- Not explained

 

Let's take a look at the implementation of static resources:

Set the text attribute to a static string on the page

 

Where are these static resources defined?

Create three new resource XAML (same as style)

 

OK. Let's take a look at what we will do when we change the language-not to explain :)

 

What if I asked the application to find the static resource file? We need to dynamically add resource files to the memory as follows:

Note: because it is a resource file, you need to add/project; component/otherwise you will not be able to find the resource

 

From http://www.cnblogs.com/alexis/archive/2011/09/07/2170276.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.