afdesigns
afdesigns

Reputation: 77

Using session values on Windows Phone 7

I am developing a Windows Phone 7 silverlight application but, i can't use the session values to "navigate" between different pages on windows phone 7. I also used "Isolated Storage" but i couldn't get the values.

Upvotes: 0

Views: 2036

Answers (2)

afdesigns
afdesigns

Reputation: 77

Thanks Adam Houldsworth for your response, it really helped me. However i found a simpler solution.

We can create a Global Variables Class in "App.xaml.cs" file and put the variables in it. The class is accessible from everywhere.

Example:

public static class GlobalVariables
{
   public static string my_string = "";
   public static int my_int = "";
}

Then we access the Global Variables class like this: project_Name.GlobalVariables.variable_name;

Upvotes: 0

Adam Houldsworth
Adam Houldsworth

Reputation: 64487

This sample shows some persistence mechanisms:

http://www.scottlogic.co.uk/blog/colin/2011/05/a-simple-windows-phone-7-mvvm-tombstoning-example/

You can also use Query Strings to pass information between two pages. The values that make up a query string are appended to the URI.

Personally, I have a centralised controller class that gets instantiated with the main App class. Any values that need passing are placed in here, in one way or another.

Upvotes: 1

Related Questions