I have static resource in my app.xaml where i want to change the value, but it gives the exception below:
<Application.Resources>
<sys:Int32 x:Key="Test">80</sys:Int32>
</Application.Resources>
In code behind to change the value
App.Current.Resources["Test"] = 120;
Exception
The method or operation is not implemented
How to change the value of the field?
As far as I know you cannot change that value at runtime. But you can do something like this:
App.Current.Resources.Remove("Test");
App.Current.Resources.Add("Test", 120);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.