在 Compact Framework 的 resx 文件中存储自定义属性
我们正在开发一个 CF 应用程序,并利用框架中的默认本地化/资源处理(也就是说,在设计器中编辑表单时,文本等属性的值存储在 .resx 文件中,资源管理器和框架加载 。
我们有一些自定义控件,其中之一包括一个名为 EditTitle 的字符串属性 我们希望在编辑设计器时将此值存储在 resx 文件中,以获得与 Text 属性相同的本地化支持,但我们找不到任何地方可以指定它。我们确实有一个用于其他设计时属性的 .xmta 文件,但我们在其中找不到任何会触发此行为的元素。
有什么方法可以为特定属性指定此行为。是否可以对我们自己的属性执行此操作,或者 Visual Studio 硬连线为仅使用一组已知的属性,我们应该寻找其他解决方案(例如手动编辑 resx 文件并希望 ApplyResources 调用能够正常工作)应用 EditTitle 属性)?
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)
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.
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,找到了解决方案(实际上是不言而喻的)。您可以通过 DesignTimeAttributes.xmta 文件添加以下属性:
此可本地化属性将确保设计器中输入的值最终出现在 .resx 文件中
Well, discovered the solution (was pretty self-evident, actually). You can add the following attribute via the DesignTimeAttributes.xmta file:
This Localizable attribute will make sure that the value entered in the designer ends up in the .resx file