Resource localization: use of x:Uid referring to another assembly's resource

localization, visual-studio-2012, windows-8, winrt-xaml, xaml

Solution

I had the same problem for a long time. But after testing a little bit, I solved it by writing the whole Path of the Resources in the XAML Code.

Something like this:

<TextBlock x:Uid="/ResourcesLibrary/Resources/ResourceTest" />

Unfortunately this answer came very late, but may it can help other persons.

Problem

I am writing a win8 application and will be using the built-in resource management system: `resw` file and `x:Uid` tags in my XAML code. So I create let's say a `TextBox` like that: ``` <TextBlock Style="{StaticResource HeaderTextStyle}" x:Uid="ResourceTest"/> ``` I create the corresponding resource file in my assembly with a `ResourceTest.Text` entry and it works fine: proper text is displayed at runtime. Now, I would like to move all my resx files to another C# Library for maintainability. So I put the resources file in a brand new project and reference this new assembly from the main assembly. But this causes the previous construct to fail (no text is displayed). However, if I programmatically retrieve the resource value using the following code from inside the side assembly (called ResourcesLibrary), I get the string correctly: ``` static ResourceLoader resourceLoader = null; public static string GetString(string resourceName) { if (resourceLoader == null) resourceLoader = new ResourceLoader ("ResourcesLibrary/Resources"); return resourceLoader.GetString (resourceName); } ``` How do I enable the `x:Uid` mechanism when dealing with out-of-assembly resources? I tried a few things in the `x:Uid` such as `ResourcesLibrary/Resources/ResourceTest` but with no luck.

Original source