Skip to main content

Passing Query string between pages in Windows Phone 8 C#

 Using the query string

You can pass parameters through the query string, using this method means have to convert your data to strings and url encode them. You should only use this to pass simple data.

NavigationService.Navigate(new Uri("/Pasge2.xaml?parameter=value", Urikind.Relative));


Pick it up on the target page using NavigationContext.QueryString:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    if (NavigationContext.QueryString.ContainsKey("key"))
    {
         string val = NavigationContext.QueryString["key"];
    }
}

Comments