Localizing WPF with .resx files
WPF用Resource.resX中的字符串进行国际化
增加命名空间
xmlns:prop="clr-namespace:XXAppName.Properties"
引用的地方的格式如下:
<Button x:Uid="testButtonId" Content="{x:Static prop:Resources.Please}" />
在ResX文件中有一个词条叫Please,
在设计器中可以看到,按钮的文字已经变成对应的词条了,但是运行时会发生
Provide value on 'System.Windows.Markup.StaticExtension' threw an exception.'
放狗搜到微软的方法:
I believe your resources are generated as an internal class. WPF is trying to resolve resource from another assembly so it wont succeed until your resources are marked as public. Consider using PublicResXFileCodeGenerator tool introduced in Visual Studio 2008.
在Solution Exploer里选中Resources.resX 在下面的自定义工具里把
ResXFileCodeGenerator改为
PublicResXFileCodeGenerator
选中Resources.resX 点运行自定义工具
重新编译,运行,问题解决。
Localizing WPF with .resx files的更多相关文章
- WPF: 本地化(Localization) 实现
本文将讨论一种较为方便的本地化方法. 由于在项目中要实现本地化,所以在网上查找相关的解决方案.通过一系列调研,发现实现本地化的方法主要有以下三种: 通过编译项目以设置 x:Uid 并使用 LocBam ...
- Infralution.Localization.Wpf
WPF Localization Using RESX Files Once you have downloaded the source code and built it, add a refer ...
- 缓动公式整理(附:C#实现及WPF原版对比)
前言 缓动在动画效果中应用非常广泛,在合适的时候使用一些缓动效果会使得效果更加符合人的直观感受,简单来说,会显得更加自然. WPF提供了11种缓动效果,涵盖了大部分的使用场景.不过如果需要在非WPF下 ...
- Code Project精彩系列(转)
Code Project精彩系列(转) Code Project精彩系列(转) Applications Crafting a C# forms Editor From scratch htt ...
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q144-Q146)
Question 144You are developing a Feature that will be used in multiple languages.You need to ensure ...
- C++: read SQL server data using System::Data::SqlClient
stdafx.h: // stdafx.h : include file for standard system include files, // or project specific inclu ...
- Sharepoint学习笔记—习题系列--70-576习题解析 -(Q56-Q58)
Question 56You work for a manufacturer who needs to advertise its catalog of products online using a ...
- Visual Studio - File Properties (Build Action, Copy to Output Directory)
Ref: MSDN (https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/0c6xyb ...
- Add Languages to Your Xamarin Apps with Multilingual App Toolkit
With Xamarin, you can extend your cross-platform apps with support for native speakers, reaching mar ...
随机推荐
- javascript —— HTTP头文件详解
HTTP(超文本传输协议:HyperText Transfer Protocol)是浏览器和服务器通过internet进行相互通信的协议,也是网络上应用最为广泛的一种网络协议.HTTP规范由World ...
- 【OpenOffice+swftools】在线预览环境的搭建和xpdf中文包的配置
[环境参数] Host:Win7 64bit VMware:VMware Workstation11.1.0 Client OS:CentOS release 6.5 (Final) 2.6.32-4 ...
- ext 参考资料
http://extjs.org.cn/ 中文网站 http://www.sencha.com/ 英文网站 http://www.qeefee.com 个人总结
- vs常用插件之javsscript插件
1.JSEnhancements 折叠JS和CSS代码 http://visualstudiogallery.msdn.microsoft.com/0696ad60-1c68-4b2a-9646-4b ...
- win7 文件共享 xp
前几天因为需要将win7内一文件夹共享给XP使用,因为NT5跟NT6安全机制的问题,共享的实现没有XP共享的方便,很多人是牺牲(关闭)了win7的系统防火墙才达到共享给XP的目的,但是关闭防火墙势必会 ...
- android 动画NineOldAndroid
NineOldAndroid 1.之前我们用到的第动画是frame和tween动画也就是帧动画,补间动画现在多了一种动画,它包含完了前面动画的所有状态. 属性动画(Property Anmation) ...
- dojo grid 分页
dojo很强大,也很方便,但是缺少文档,只能看源代码,也挺好的,就是费时间... 网上找了一段代码(找不到原出处了,不好意思),也看了dojo自带的demo,放一段可以执行的页面代码这里.把ip换成自 ...
- javascript数据缓存
if(!self.hotCityPrice[city]) { $.ajax({ type: 'GET', url: self.hotCityUrl, data: {cityCode: city, t: ...
- java搭建finagle(2)
上篇文章是1年前写的惭愧惭愧,今天一个同事问我要demo然后看了下文章 好吧主要的代码 没写出来,今天补充下 上篇地址:http://www.cnblogs.com/rufus-hua/p/41592 ...
- 博客标题栏增加一个"闪存“按钮
最近来博客园喜欢去闪存上看看,也就是一个类似微博的东西,但是貌似没看到哪里有这个按钮. 所以只要自己动手搞一个. 暴力猴js: // ==UserScript== // @name fwindpeak ...