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;
Setup global variables, quick and easy, make a new class for GlobalVariables:
public static class GlobalVariables
{
public static string my_string = "";
public static int my_int = -1;
}
Then you access the Global Variables class like this:
GlobalVariables.variable_name;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With