Question

I'm using the resources to make my wpf application avaible in other languages, so I added this to my MainWindow.xaml

xmlns:p="clr-namespace:MusicApp.Properties"  

and this to an example button in the .xaml

Text="{x:Static p:Resources.Test}"

Originally my Resources.resx only have one line:

name -> Value
Test -> testing

and the button text was "testing" all good, but now I changed the line to

Prueba -> probando

and the .xaml to:

Text="{x:Static p:Resources.Prueba}"

and now I got this error (translated from spanish so it could be wrong)

cannot access to member "Prueba"

Obviously Resources is public, but if I change back the .xaml to the old one (with Test) It's still working although Test is deleted from Resources.

I think Visual studio is not reloading the form or something, any idea?

Était-ce utile?

La solution

The problem is your not binding the value, instead you just assigning the value for the text... So try the below...

 Text="{Binding Source={x:Static p:Resources.Prueba}}"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top