在XAML * .resx文件获取值 [英] Get values from *.resx files in XAML

查看:117
本文介绍了在XAML * .resx文件获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能从增加资源文件的一些值右转入XAML标记?或本地化,我们总是不得不在* cs文件是这样的:

Is it possible to add some value from resource file right into the XAML markup? Or for localization we always have to make something like this in *.cs file:

txtMessage.Text = Messages.WarningUserMessage;

其中,的消息的资源, txtMessage 是TextBlock的。

Where Messages is resource, and txtMessage is TextBlock.

推荐答案

确保code生成设置为公共的RESX编辑器,那么你可以简单地使用:

Make sure that Code Generation is set to Public in the resx editor, then you can simply use:

<TextBlock Text="{x:Static Messages.WarningUserMessage}" />

这篇关于在XAML * .resx文件获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆