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的更多相关文章

  1. WPF: 本地化(Localization) 实现

    本文将讨论一种较为方便的本地化方法. 由于在项目中要实现本地化,所以在网上查找相关的解决方案.通过一系列调研,发现实现本地化的方法主要有以下三种: 通过编译项目以设置 x:Uid 并使用 LocBam ...

  2. Infralution.Localization.Wpf

    WPF Localization Using RESX Files Once you have downloaded the source code and built it, add a refer ...

  3. 缓动公式整理(附:C#实现及WPF原版对比)

    前言 缓动在动画效果中应用非常广泛,在合适的时候使用一些缓动效果会使得效果更加符合人的直观感受,简单来说,会显得更加自然. WPF提供了11种缓动效果,涵盖了大部分的使用场景.不过如果需要在非WPF下 ...

  4. Code Project精彩系列(转)

    Code Project精彩系列(转)   Code Project精彩系列(转)   Applications Crafting a C# forms Editor From scratch htt ...

  5. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q144-Q146)

    Question 144You are developing a Feature that will be used in multiple languages.You need to ensure ...

  6. C++: read SQL server data using System::Data::SqlClient

    stdafx.h: // stdafx.h : include file for standard system include files, // or project specific inclu ...

  7. Sharepoint学习笔记—习题系列--70-576习题解析 -(Q56-Q58)

    Question 56You work for a manufacturer who needs to advertise its catalog of products online using a ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. Vmware虚拟机的网络设置

    设置宿主机器的Vmnat8网络适配器. 设置IP地址如图所示 设置虚拟机的的网络 选择NAT方式 启动虚拟机,设置虚拟机的网络适配器

  2. ListCell Animation in ListView

    After a long time I am back again with new stuffs. I have seen that JavaFX has got so many demand no ...

  3. HDU 4614 Vases and Flowers (2013多校2 1004 线段树)

    Vases and Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others ...

  4. printf输出字符串的一些格式

    1. 原样输出字符串:    printf("%s", str); 2. 输出指定长度的字符串, 超长时不截断, 不足时右对齐:    printf("%Ns" ...

  5. iOS Ping++前端集成支付

    直接上代码 /* 获取订单charge 1.buyerId  买家ID 2.sellerId  卖家ID 3.liveId    直播间ID 4.goodCount 商品数量 5.status    ...

  6. spring事物配置注意事项

    <tx:advice id="txAdvice" transaction-manager="transactionManager">  <tx ...

  7. (C#)使用队列(Queue)解决简单的并发问题

    (C#)使用队列(Queue)解决简单的并发问题 2015-07-16 13:04 13265人阅读 评论(8) 收藏 举报  分类: Asp.Net(8)  版权声明:本文为博主原创文章,未经博主允 ...

  8. redis的文件事件处理器

    前言     C10K problem提出了一个问题,如果1w个客户端连接到server上,间歇性的发送消息,有哪些好的方案?     其中的一种方案是,每个线程处理多个客户端,使用异步I/O和就绪通 ...

  9. Mac OS X取消Apache(httpd)开机启动

    安装MAMP后,启动服务时提示Apache启动失败,80端口被占用.查看进程发现存在几个httpd. OS X自带Apache,可是默认是没有启动的.我也没有开启Web共享,怎么就开机启动了呢? 不知 ...

  10. SCCM客户端推送/卸载

    站点配置--站点--层次结构设置--自动批准客户端 ccm客户端安装日志:服务器端的ccm.log安装ccm客户端,需要添加一个具有访问客户端$admin权限的账户,如下:站点名称-右键 客户端安装设 ...