绑定中的 XAML 绑定
我想绑定“MenuItemDescription” 如何?
Text="{Binding Path=LocalizedRessources.MenuItemDescription, Source={StaticResource LocalizedStrings}}"
提前谢谢您
编辑:
我会尝试更明确: 我想替换“MenuItemDescription”,它目前是使用绑定动态地由字符串硬编码的
抱歉我的英语,我使用谷歌翻译来帮助我
I'd like to bind "MenuItemDescription"
How?
Text="{Binding Path=LocalizedRessources.MenuItemDescription, Source={StaticResource LocalizedStrings}}"
In advance thank you
edit:
I'll try to be more explicit:
I'd like to replace "MenuItemDescription" which is currently hard coded by a string dynamicly using a binding
Sorry for my English, I use google translate to help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜您要么想要绑定到 Windows 资源文件 (.resx) 中定义的字符串,要么想要使用 WPF 资源字典中定义的值。
对于第一种情况,您需要绑定到静态属性,例如:
由于您只能绑定到公共静态属性,因此您需要将 LocalizedResources.resx 的访问修饰符更改为 public (默认为内部)。打开资源文件,您可以更改访问修饰符。
对于第二种情况,您需要在资源字典(可能是 app.xaml)中定义字符串,然后将其用作静态资源,例如:
在您的字典中
在您的控件中
I'm guessing you either want to bind to a string defined in a Windows resource file (.resx), or you want to use a value defined in a WPF resource dictionary.
For the first case you need to bind to a static property, e.g.:
Since you can only bind to public static properties you need to change the access modifier of your LocalizedResources.resx to public (defaults to internal). Open the resource file and you can change the access modifier.
For the second case you need to define the string in a resource dictionary (possibly app.xaml) and then use that as a static resource, e.g.:
In your dictionary
In your control