Arzoo Singh
Arzoo Singh

Reputation: 1

Passing Values between two xaml Pages in Windows Phone 8 App

In the Below Code, I want to pass Value of TextBlock1 which is in Navigation Page to the TextBlock2 which is in the Destination Page...!

Code in Navigation Page :

NavigationService.Navigate(new Uri("/Views/DestinationPage.xaml?parameter=textBlock1.Text", UriKind.Relative));

Code in Destination Page :

string parameter = string.Empty;
        if (NavigationContext.QueryString.TryGetValue("parameter", out parameter))
        {
            this.textBlock_Result.Text = parameter;
        }

Upvotes: 0

Views: 55

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222532

Navigation page:

 NavigationService.Navigate(new Uri("/Views/DestinationPage.xaml?parameter=" + textBlock1.Text, UriKind.Relative));

Destination Page :

if(NavigationContext.QueryString.TryGetValue(“parameter”,out parameter))
{  
  this.textBlock_Result.Text = parameter;
}  

Upvotes: 1

Related Questions