在Compact Framework中将自定义属性存储在resx文件中 [英] Storing custom properties in resx files in Compact Framework

查看:75
本文介绍了在Compact Framework中将自定义属性存储在resx文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发CF应用程序,并在框架中使用默认的本地化/资源处理功能(即,在设计器中编辑表单时,诸如Text之类的属性的值都存储在.resx文件和资源管理器中并且框架使用卫星程序集并在.Designer文件中调用ApplyResources在选定的语言环境中再次将其加载给我们)

We are developing a CF application and are making use of the default localization/resource handling in the framework (that is, when editing a form in the designer properties like Text have their value stored in the .resx files and the resource manager and framework loads it for us again in the selected locale using satelite assemblies and a call to ApplyResources in the .Designer file)

我们有一些自定义控件,其中一个包含名为EditTitle的字符串属性.在编辑设计器以获得与Text属性相同的本地化支持时,我们希望将此值存储在resx文件中,但是我们找不到任何地方可以指定此值.我们确实有一个用于其他设计时属性的.xmta文件,但在其中找不到任何会触发此行为的元素.

We have a few custom controls and one of these includes a string property called EditTitle. We would like this value to be stored in the resx file when editing the designer to get the same localization support as the Text property but we can't find anywhere to specify this. We do have an .xmta file for other designtime attributes but we can't find any element in there that would trigger this behavior.

是否有任何方法可以为特定属性指定此行为.是否可以针对我们自己的属性执行此操作,或者是否将Visual Studio硬连接为仅与一组已知的属性一起使用,并且我们应该寻找其他解决方案(例如手动编辑resx文件,并希望ApplyResources调用能够接听和解决).是否应用EditTitle属性)?

Are there any way to specify this behavior for the particular property. Is it possible to do this for our own properties or is Visual Studio hardwired to only work with a known set of properties and we should be looking for other solutions (like editing the resx file by hand and hoping that the ApplyResources-call picks up and applies the EditTitle property)?

推荐答案

好,发现了解决方案(实际上是不言而喻的).您可以通过DesignTimeAttributes.xmta文件添加以下属性:

Well, discovered the solution (was pretty self-evident, actually). You can add the following attribute via the DesignTimeAttributes.xmta file:

<Property Name="EditTitle">
  <Localizable>true</Localizable>
</Property>

此可本地化属性将确保在设计器中输入的值最终出现在.resx文件中

This Localizable attribute will make sure that the value entered in the designer ends up in the .resx file

这篇关于在Compact Framework中将自定义属性存储在resx文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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