c# - When i change CurrentUICulture text property doesn't change -
i have following problem. wpf solution include 2 resx files 2 rows
resources.resx -name: ismanager value: yes | name: isnotmanager value: no resources.pl-pl.resx -name: ismanager value : tak | name: isnotmanager value: nie
i have simple textblock in mainwindow
<textblock text="{x:static prop:resources.ismanager}" />
question why when change currentuiculture pl-pl, text property in textblock doesn't change ? understand property initialized once , should 'refresh' value of property, there option automaticly ? below code change it.
private void button_click_1(object sender, routedeventargs e) { thread.currentthread.currentuiculture = new cultureinfo("pl-pl"); }
what can change text property ?
if bind static value not refresh, must open window or recreate view or ui, more precise textblock must recreated in order evaluate text property once again.
the solution runtime localization. have several alternatives.
using dynamic resources , bindings: http://www.codeproject.com/articles/17334/localizing-wpf-applications-using-locbaml
using objectdataprovider: http://www.codeproject.com/articles/22967/wpf-runtime-localization#automaticupdatingwithodp
you can find several resources searching after wpf runtime localization http://altfo.wordpress.com/2009/02/18/wpf-localization-or-xaml-localization/
Comments
Post a Comment