Search code examples
c#xamlwindows-store-apps

Using ResourceLoader.GetString method to retrieve resources with dots in the key


I'm using ResourceLoader.GetString to get string resources from my .resw file. I'm able to retrieve resources without a dot in the key, but ones with a dot come back as an empty string. For example:

var rl = new Windows.ApplicationModel.Resources.ResourceLoader();
rl.GetString("HelpText"); // gets the string "Help"
rl.GetString("Forget.Text"); // gets "", even though it's defined in resw file as "Forgotten"

I've tried replacing the dot with various other characters:

rl.GetString("Forget_Text");
rl.GetString("Forget:Text");
rl.GetString("Forget-Text");

No luck. All the examples on MSDN skilfully avoid mentioning this little issue, so I'm a bit stumped. Can anyone help?


Solution

  • It is actually accessed via a forward-slash:

    rl.GetString("Forget/Text");