开发者

Dynamic localization with Data Annotations possible?

开发者 https://www.devze.com 2022-12-25 10:22 出处:网络
I\'m trying to dynamicly update the language of a Silverlight application. I tried the examp开发者_StackOverflow中文版le provided by Tim Heuer and that was exactly wat I needed.

I'm trying to dynamicly update the language of a Silverlight application. I tried the examp开发者_StackOverflow中文版le 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号