argledhel
argledhel

Reputation: 197

WPF: Localization using RESX not working in Resources

I am localizing my project using the RESX way (http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files).

I have had no problems so far when localizing strings inside the <Window> scope, for instance:

ribbon:RibbonTab Header="{Resx W.Misc}"

I tried to localize strings inside the <Window.Resource>, for example:

<Button x:Key="Misc Button" Content ="{Resx W.Misc}"></Button>

When I used the resource, the button instead shows up: #W.Misc.

Why is that happening?

Upvotes: 0

Views: 1460

Answers (1)

argledhel
argledhel

Reputation: 197

Grant Frisken actually helped me to solve this problem:

"The DefaultResxName specified for the window does not work for Window.Resource because the resource is not a framework element parented by the window. So you will have to explicitly set the ResxName property. For instance:"

<Button x:Key="Misc Button" Content ="{Resx ResxName=WpfApp.MainWindow, Key=W.Misc}"></Button>

Upvotes: 2

Related Questions