c# - DynamicResource doesn't show the correct value -


i have problem dynamicresource , mergeddictionary. have software can displayed in different languages (english, spanish, german) , have lot of resourcedictionaries. give 1 example of dictionary, called "documentation.xaml":

<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"                     xmlns:system="clr-namespace:system;assembly=mscorlib">      <system:string x:key="productnumber">product number</system:string>     <system:string x:key="notes">notes</system:string>     <system:string x:key="logo">logo</system:string>     <system:string x:key="inspectiontask">inspection task</system:string>     <system:string x:key="productdescription">product description</system:string> </resourcedictionary> 

this "default" resourcedictionary. have 2 other dictionaries called "documentation.de-de.xaml" , documentation-es-es.xaml" german , english. same default dictionary. difference displayed string.

now problem: when access ressource via "dynamicresource" result active dictionary. (example: "descripcion de producto" "productdescription" in spanish.) if entry available inside dictionary works fine. problem appears when 1 entry not available. assuming following situation: running software in spanish , want change german, 1 entry in dictionary not available, software not using default entry it. still has value spanish dictionary.

in opinion dynamicresource crashing in case , don't change. don't have proof crashing. fact have is, textbox won't change if entry not exist! there way handle crash? (if one)

i hope have information need. if not please let me know

assuming following situation: running software in spanish , want change german, 1 entry in dictionary not available, software not using default entry it. still has value spanish dictionary.

this expected behaviour. target property set using dynamicresource markup extension change when resource changed. if resource removed, target property won't reset.

you should make sure each resourcedictionary contains exact same translation keys.

the other option implement own custom markup extension. please refer following links more information this.

https://wpftutorial.net/localizemarkupextension.html http://10rem.net/blog/2011/03/09/creating-a-custom-markup-extension-in-wpf-and-soon-silverlight https://github.com/seriousm/wpflocalizationextension https://www.codeproject.com/articles/35159/wpf-localization-using-resx-files


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -