可以使用数据注释进行动态本地化吗?
我正在尝试动态更新 Silverlight 应用程序的语言。我尝试了 Tim Heuer 提供的示例,这正是我需要的。 Silverlight 和本地化字符串数据
现在我'我正在尝试数据注释并希望有相同的行为。但没有运气...... 有人能指出我正确的方向吗?
属性的数据注释:
[Display(Name = "UserNameLabel", ResourceType = typeof(Resources.Strings.StringResources))]
[Required]
public string Username
...
我的 Xaml:
<dataInput:Label Target="{Binding ElementName=tbUserName}" PropertyPath="UserName"/>
<TextBox x:Name="tbUserName" Text="{Binding UserName, Mode=TwoWay}" />
谢谢, 罗恩
I'm trying to dynamicly update the language of a Silverlight application. I tried the example provided by Tim Heuer and that was exactly wat I needed.
Silverlight and localizing string data
Now I'm experimenting with Data Annotations and would like to have the same behaviour.But with no luck...
Can someone point me in the right direction.
DataAnnotation of a property:
[Display(Name = "UserNameLabel", ResourceType = typeof(Resources.Strings.StringResources))]
[Required]
public string Username
...
My Xaml:
<dataInput:Label Target="{Binding ElementName=tbUserName}" PropertyPath="UserName"/>
<TextBox x:Name="tbUserName" Text="{Binding UserName, Mode=TwoWay}" />
Thanks,
Ron
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论