WP7开发App / Page wide变量 [英] WP7 Development App/Page wide variable
本文介绍了WP7开发App / Page wide变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道如何设置一个可以在Windows Phone 7应用程序的所有页面上访问的变量吗? 解决方案
如果不知道具体情况,可以创建变量作为您的App类的成员:应用程序
{
...
public int foo {get;组; }
...
}
然后从任何地方访问:
(App.Current as App).foo = 3;
Does anyone know how to set a variable that can be accessed on all pages of a Windows Phone 7 App?
解决方案
Without knowing any more specifics of your situation, you could create the variables as members of your App class:
public partial class App : Application
{
...
public int foo { get; set; }
...
}
Then access if from wherever:
(App.Current as App).foo = 3;
这篇关于WP7开发App / Page wide变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文