-
What I want to do is to implement a function that dynamically switches the software language without restarting the software or using DynamicResource (because DynamicResource has relatively low performance). So I plan to achieve this by binding a Dictionary and then dynamically changing the values in the Dictionary. I first made an ObservableDictionary:
In order to facilitate use in XAML, I wrote a MarkupExtension:
This is the ViewModel:
And finally this is the XAML:
Here is the code for the XAML backend:
To facilitate your testing, I packaged and uploaded the entire project: After the program starts, the default bound data will be displayed normally. However, when I click the button to try to change the bound data content, the UI still displays the original data. What is the reason? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You need to use 'Item' as the argument OnPropertyChanged. That is the name of the property. The indexer, '[key]', is not part of the property name. |
Beta Was this translation helpful? Give feedback.
It should be
OnPropertyChanged("Item")
. 'Item' is the name of the property.