Default ValueConverter for a class in WPF

自作多情 提交于 2019-12-06 15:39:53

The prescribed way of doing localization for WPF, is to create localized BAML in satellite assemblies; this is achieved by adding the x:Uid attached property to elements you wished to be localized. There is a nice WPF Globalization and Localization section on MSDN describing the techniques.

Another approach I would suggest would be to create a static 'Localization Dictionary' type, and to implement ICustomTypeDescriptor, to redirect incoming property binds to strings in your dictionary. You could end up doing something like this:

<Button Content="
    {Binding Source={x:Static local:MyStaticType.Localization}, 
             Path=HelloButtonTitle}" /> 

And you could continue to leverage existing technologies such as RESX + Satellite assemblies.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!