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 ...
随机推荐
- Spark RDD概念学习系列之RDD是什么?(四)
RDD是什么? 通俗地理解,RDD可以被抽象地理解为一个大的数组(Array),但是这个数组是分布在集群上的.详细见 Spark的数据存储 Spark的核心数据模型是RDD,但RDD是个抽象类 ...
- HD2029
Palindromes _easy version Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/O ...
- mvn安装jar文件到本地
mvn install:install-file -DgroupId=com.jfinal -DartifactId=jfinal -Dversion=2.3 -Dpackaging=jar -Dfi ...
- AcceptEx与WSAEventSelect和Accept
(转自论坛的一个帖子http://bbs.csdn.net/topics/280032853) AcceptEx主要用于向完成端口 投递一个或多个的连接请求..当有连接时进来,这里分两种情况: 1.A ...
- ELF学习--重定位文件
add.c int data = 1;int bss;const int rodata = 1;int add(int num1, int num2){ int sum = 0; sum = num1 ...
- SQLServer获取随机数据
1.比较常见和好用的一种 SELECT TOP 10 *, NEWID() AS randomFROM tableORDER BY random --newid函数会随机生成一个guid,很长的一个字 ...
- INNO&&DELPHI
好久不弄delphi了,再次见到inno,居然不知所措~ 让人亲切的 var,又见到了.而如今,到处可见. 整目录复制 Flags: igNoreversion recursesubdirs crea ...
- 大数据平台搭建(hadoop+spark)
大数据平台搭建(hadoop+spark) 一.基本信息 1. 服务器基本信息 主机名 ip地址 安装服务 spark-master 172.16.200.81 jdk.hadoop.spark.sc ...
- extjs tablepanel 高度自适应有关问题
extjs tablepanel 高度自适应问题 项目中为了给客户好点的功能切换体验,想到了用extjs的tabpanel 在页面中用了tabpanel后,高度新打开的tab页的iframe 的高度总 ...
- 查看sid
查看用户sid: whoami /user 查看系统sid: 使用PSTools工具中的 psgetsid.exe命令查看