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