Resource strings are accessible as static members in the auto-generated Resources
class, found in <Default.app.namespace>.Properties.Resources
. Properties
and Resources
are both unfortunate namespace names that clash with properties or namespaces that you probably already have in scope when writing WPF code. So you may have to use the fully-qualified name. e.g.
MyProject.Properties.Resources.AppName
for the string defined in Resources.resx
with the name "AppName".
You should prefer this method of getting string resources over calling FindResource
, as it provides compile-time checking of resource string names.
FFS. How can this not already be given as an answer, people?