MissingManifestResourceException 找不到适合指定区域性或中性区域性的任何资源
在我的 WPF 应用程序中,我有三个 .resx 文件:Resources.en-US.resx、Resources.resx 和 Resources.nl-BE.resx。每个资源文件都构建为嵌入式资源。在每个 wpf 视图中,我已将每个控件绑定到正确的静态资源字符串。
Resources.Designer.cs 文件中的静态 ResourceManager 构造函数使用正确的命名空间和基本名称实例化 ResourceManager。
在初始化期间,我运行以下代码行:
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
如果我的区域和语言格式为 en-US 或 nl-BE,则 UI 中的元素将显示正确的本地化字符串。如果我将“区域和语言”格式设置为其他内容,例如“英语 – 津巴布韦”,则会收到 XamlParseException。我怀疑它正在尝试查找 en-ZW 资源。如何确保如果找不到该区域性的资源,它默认为我的 Resources.resx?
In my WPF application I have three .resx files: Resources.en-US.resx, Resources.resx, and Resources.nl-BE.resx. Each resource file is built as an embedded resource. In each wpf view, I`ve bound the each control to the proper static resource string.
The static ResourceManager constructor in the Resources.Designer.cs file instantiates a ResourceManager with the correct namespace and basename.
During initialization, I run the following line of code:
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
If my Region and Language format is en-US, or nl-BE, the elements in the UI show the correct localized string. If I set my Region and Language format to something else like English – Zimbabwe
I get an XamlParseException. I suspect that it's trying to find the en-ZW resource. How do make sure if the resource for that culture is not found, it defaults to my Resources.resx?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论