Search code examples
wpfxamllocalizationresourcesresx

XAML Resx localization not working as expected


I'm attempting to use a resx file to localize some strings I am using in a XAML file. I've looked around at other documentation on the web, and they all seem to recommend a two part process:

  1. Add a clr-namespace to your window, like this:
    xmlns:props="clr-namespace:PJConfiguration.Properties"

  2. Use that namespace to localize your string like this:
    Content="{x:Static props:Resources.SharedSettings}"

I've done this, and also made sure that my resource classes are public, but I still get the following error from the XAML in step 2:

Cannot find the type 'Resources'.

Does anyone know what else might be causing this problem? Thanks in advance.


Solution

  • Check if your .resx file is the default Resources.resx file inside the Properties directory of the Application assembly. If that is, there is no reason XAML couldn't find the public class Resources from the correct namespace under local assembly.