I have a WPF program, and when I localize it, it fails. I entered created this XML namespace, which corresponds to the file location, in the Window
element:
xxxxxxxxxx
xmlns:properties="clr-namespace:ResxEditor.Properties"
This is how I am localizing each element:
xxxxxxxxxx
<Button Content="{x:Static properties:Resources.FilePickerButton_AddFile}" />
The designer works perfectly fine, and I when I choose Resources.
, auto-complete pulls up the available items, but when I build my application, it crashes with this error message:
Exception thrown: ‘System.Windows.Markup.XamlParseException’ in PresentationFramework.dll
Additional information: ‘Provide value on ‘System.Windows.Markup.StaticExtension’ threw an exception.’ Line number ‘5’ and line position ‘9’.
The line number and position correspond to the first x
in the namespace I have given above. I tried searching this message on the web, and I can’t seem to find anything.
After an hour or so of searching the web, I randomly happened to try changing the access modifier on my Resources.resx file from internal
to public
. To do so, open your .resx file in the Visual Studio editor, and change the drop-down menu labeled “Access Modifier” to “public”, which should be the only other option besides “internal”.
This will change all the items in the .designer file to use the public
access modifier. An example of these items looks like:
xxxxxxxxxx
/// <summary>
/// Looks up a localized string similar to Add Files.
/// </summary>
public static string FilePickerButton_AddFile {
get {
return ResourceManager.GetString("FilePickerButton_AddFile", resourceCulture);
}
}