Force UI update on the fly, after changing current culture in WPF

前端 未结 3 1072
忘了有多久
忘了有多久 2021-02-04 07:31

I need to support UI language change through the application menu. The texts are localized using resource files (similar to approach 1 here)

if I set the Thread.Cu

3条回答
  •  遇见更好的自我
    2021-02-04 07:50

    You could use the ResourceDictionary approach along with the DynamicResourceMarkupExtension. Using this approach you can swap out the resource dictionary representing the language the user has selected and the DynamicResourceMarkupExtension will ensure the new value is reflected in the UI.

    Also, if you're willing to venture into the realm of a custom solution, there is the LocalizeMarkupExtension which is provided in this WPF tutorial.

提交回复
热议问题