Silverlight 中的本地化,需要 XAML 中的多重绑定

发布于 2024-12-28 10:10:38 字数 462 浏览 3 评论 0原文

我们正在尝试在 Silverlight 应用程序中进行一些本地化。正常本地化没有问题:我们在 XAML 中编写绑定,并且我们的文本块项显示正确的文本。

对于数据模板或枚举中的项目,我们遇到了一些问题。我们将属性(字符串)绑定到数据模板中按钮的内容。我们在 7 个按钮上显示了 7 个值。但现在我们尝试从字典(resx)中获取这些值,但我们无法获得良好的绑定工作。这就是我们现在尝试的方法:

Content="{Binding Source={StaticResource ApplicationResources}, Path=?}"

问号处是我们用来放置静态键:ItemType 的位置。但现在我们需要从绑定到按钮的父级(列表框)的集合中获取值。

是否有任何语法可以使此绑定起作用?

我们还对绑定到组合框的枚举进行了类似的操作。关于如何使本地化发挥作用有什么想法吗?

提前致谢

We're trying to do some localization in our Silverlight app. Normal localization is no problem: we write the bindings in XAML and our textblock items show the correct text.

For items in datatemplates or for enums, we are experiencing some issues. We are binding a property (string) to the content of a button in the datatemplate. We have our 7 values shown on 7 buttons. But now we try to get those values from the dictionary (resx) and we cannot get a decent binding working. This is how we try now:

Content="{Binding Source={StaticResource ApplicationResources}, Path=?}"

At the question mark is where we used to place our static key: ItemType. But now we need to get the value from a collection bound to the parent (listbox) of the button.

Is there any syntax that can make this binding work?

We also doing something similar with enums binding to comboboxes. Any ideas on how we can get that localization to work?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文