Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows8 - Using localised string in C#

I have got problem with localizing my app. I have got file Resources.resw with string "noResults.Text" in it (it ends with .Text because I use it in xaml for textblock (x:Uid) ) Problem is that I want to use the same string in code behind (C#) How I can access it? I have tried something like this :

resourceLoader.GetString("noResults");
resourceLoader.GetString("noResults.Text");

But none of this work

Thanks in advance :)

like image 664
Krzysztof Kaczor Avatar asked Jul 23 '12 20:07

Krzysztof Kaczor


1 Answers

Do something like this:

var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
string result = loader.GetString("noResults/text");

Note that in your resource, if you are using "noResults.text", do not define another string as "noResults" (no extension).

like image 96
Gambit Avatar answered Oct 01 '22 11:10

Gambit