简体   繁体   English

如何在wp8中更改StaticResource的值

[英]How to change value of StaticResource in wp8

I have static resource in my app.xaml where i want to change the value, but it gives the exception below: 我的app.xaml中有静态资源,我想在其中更改值,但是它给出了以下异常:

<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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM