开发者

How to store / access a global state object in Silverlight? (phone7)

开发者 https://www.devze.com 2023-01-18 10:42 出处:网络
I\'m building an application on Phone 7 using Silverlight and need to maintain some state between pages.I was hoping to store an object in app.cs开发者_如何学编程 and access it from each page but I ha

I'm building an application on Phone 7 using Silverlight and need to maintain some state between pages. I was hoping to store an object in app.cs开发者_如何学编程 and access it from each page but I haven't been able to find any documentation on how to do this.

What is the best way to access the same object between many different pages?

Thanks for your time,

-- Henry


Answered my own question. I can access objects in app.cs by simply doing:

App app = (App)Application.Current;
app.whateverMyObjectIsCalled

Is this a reasonable thing to do?

0

精彩评论

暂无评论...
验证码 换一张
取 消