top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Explain WindowsPhone Application/Global variable?

+3 votes
85 views
Explain WindowsPhone Application/Global variable?
posted Jul 2, 2015 by Karthi Kumar

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

We can set a variable that can be accessed on all pages of a Windows Phone App

Step1:

App.xaml.cs

public partial class App : Application
   {
        public string sName { get; set; }
   }

Step2:

Now access application variable "sName" in entire application like this

(App.Current as App).sName = "Test value";//set value                                                               
string myvalue=(App.Current as App).sName;//get value
answer Jul 3, 2015 by Jdk
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...