WPF Resources not found in Xaml
Hi all,
I have several language resource files in the form of Resources.{language}.resx situated in the ‘Properties’ folder
I can view all of them perfectly and their expected values in Localization Manger.
In the Resource.resx I have such an entry
<data name="A-Key" xml:space="preserve">
<value>SomeValue</value>
</data>
In my Xaml I have this namespace declared
xmlns:resources="clr-namespace:{MyNamespace}.Properties"
However wherever I use them on control such as:
<Label Content="{x:Static {MyNameSpace}:StringResources.{A-Key}}"
I get error “Unable to resolve symbol {A-Key}”
Can someone please point me to what I am missing.
Notes. When I delete the Resources.Designer.cs, make some changes in Resource.resx, Resources.Designer.cs does not get re-generated.
Please sign in to leave a comment.
Normally you will not need to define the key-value entries in resx file directly, use Resource Manager could cover most of the situations.
Have a try to invalidate IDE caches in File | Invalidate Caches to rebuild the project model to see if IDE can resolve symbols you mentioned.
If the same problem persists, a sample solution that reproduces the issue could be useful. You can upload it here and share the upload ID.
I have the same problem, when I add something into the Resources.resx, the Designer.cs won't be generated or updated.
You can try the project: AvaloniaUI.QuickGuides/Localization/Localization.csproj at main · AvaloniaUI/AvaloniaUI.QuickGuides (github.com)
* Modify the resources.resx and it won't update the Designer.cs
* Delete the designer.cs and it won't generate a new one.
If I open this project in VS, it works good.
I'm using 2024.1.4.
Derekhe Thank you for reporting the issue, I have created a corresponding record on our bug tracker:
RIDER-114521 Cannot recognize resx files with PublicResXFileCodeGenerator generator
The issue is handled by a dedicated developer there. Please upvote it and click Watch to monitor the progress of the issue.