Friday, 15 June 2012

c# - App-wide Observable Collection -



c# - App-wide Observable Collection -

if set observable collection within separate .cs (class) file , utilize in mainpage.xaml, how can create info stored within same observable collection accessible within different xaml page @ later time?

e.g.

myclass.cs: public observablecollection<string> oc = new observablecollection<string>(); mainpage.xaml.cs: // add together observable collection secondpage.xaml.cs: // access , utilize info stored in observablecollection

i think want this:

myclass.cs: public static observablecollection<string> oc = new observablecollection<string>(); mainpage.xaml.cs: // add together observable collection secondpage.xaml.cs: // access , utilize info stored in observablecollection

once oc static, can reference 1 time again , 1 time again class / page.

if want bind (since cannot bind fields or static properties in windows 8 apps) need have xaml page reference static property in simple property:

secondpage.xaml.cs: public static observablecollection<string> oc { { homecoming myclass.oc; } }

i hope makes sense!

c# .net xaml windows-8 microsoft-metro

No comments:

Post a Comment