如何在Windows Phone 8.1应用程序中获取查询字符串?

时间:2014-05-19 16:14:03

标签: windows-phone-8.1

很抱歉提出这样一个基本问题,但我已经花了最后30分钟在谷歌上找不到任何东西(很可能是我糟糕的搜索引擎技能!)

我正在升级(好吧,移动代码)从Windows Phone 8应用程序到通用应用程序(Windows商店代码目前基本上不存在,我目前正专注于移植Windows手机的东西)。

以前我在使用

NavigationContext.QueryString.TryGetValue 

但是8.1这不起作用,我不能为我的生活找到如何获得查询字符串。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

您可以按照Vyas_27编写的方式发送参数,但使其看起来像

//id - first parameter
//value - second parameter
Frame.Navigate(typeof(SecondPage), "id&value");

获取参数

string[] parameters = ((string)e.Parameter).Split(new char[] {'&'});
string id = parameters[0];
string value = parameters[1];