c# - Passing values between XAML pages -


i'm trying build first windows 8 metro app using vs 2012 & c#.

it consists of simple 2 pages layout, first being presentation & setup page , second consists of game (a quiz).

i have created instance of player in mainpage.xaml.cs stores player name, game mode (easy, medium, hard) , subject of questions (eventually).

player p = new player(); 

whenever values set navigate maingame.xaml using

this.frame.navigate(typeof(maingame)); 

the question is: how pass such values between pages can, say, set textblock saying "name playing"?

you can pass parameter object in frame's navigate(...) method. should write this.

mainpage.xaml.cs

player p = new player(); this.frame.navigate(typeof(maingame), p); 

now object of player can in maingame.xaml.cs's onnavigatedto(...) method.

maingame.xaml.cs

protected override void onnavigatedto(navigationeventargs e)  {      var objplayer = e.parameter player;  } 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -