windows phone 8.1 - Isolated storage in In a multi-page c# -


i have created 2 pages in application ... there on front page tkstpeix write name when entering storage , set application on page, , when enter second page in application name not come out!

example: when open app , type in name "ibra" text box on second page name not appear!

->page1:

using myproject.model; public partial class test1 : phoneapplicationpage {     isolatedstoragesettings data = isolatedstoragesettings.applicationsettings;     list<userdata> objuserdatalist = new list<userdata>();     public test1()     {         initializecomponent();         this.loaded += test1_loaded;     }      private void test1_loaded(object sender, routedeventargs e)     {         if (data.contains("usernamedata"))         {             navigationservice.navigate(new uri("/test2.xaml", urikind.relative));         }     }      private void namebox_gotfocus(object sender, routedeventargs e)     {         textbox tb = (textbox)sender;         tb.borderbrush = new solidcolorbrush(colors.lightgray);     }      private void button_click(object sender, routedeventargs e)     {         data["usernamedata"] = namebox.text;         navigationservice.navigate(new uri("/test2.xaml", urikind.relative));     } } 

-->page2:

using myproject.model; public partial class test2 : phoneapplicationpage {     isolatedstoragesettings data = isolatedstoragesettings.applicationsettings;     userdata objuserdata = new userdata();     public test2()     {         initializecomponent();         this.loaded += test2_loaded;     }      private void test2_loaded(object sender, routedeventargs e)     {         if (data.contains("usernamedata"))         {              stckuserdetailsui.datacontext = objuserdata;         }     } }   <stackpanel  name="stckuserdetailsui"  grid.row="0" margin="12,17,0,28" grid.columnspan="2">             <textblock text="your details :" foreground="white" fontsize="30" textdecorations="underline"/>             <textblock fontsize="40" name="txtusername" text="{binding username}" foreground="white"/>         </stackpanel> 

--->userdata.cs: (in in file /model)

 class userdata {     public string username { get; set; } } 

note: work in windows phone 8.1 silverlight

you set datacontext objuserdata never put objuserdata.username, hence comes blank.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -