Windows Phone开发工具C#:在页面之间发送信息

Windows Phone开发工具C#:在页面之间发送信息,c#,.net,windows,vb.net,windows-phone-7,C#,.net,Windows,Vb.net,Windows Phone 7,我试图在两页之间发送几个字符串。但是,接收页面仅将其解释为一个。关于如何解决这个问题的任何建议 第1页 private void button1_Click(object sender, RoutedEventArgs e) { string urlofdestinationpage = "/Page1.xaml"; urlofdestinationpage += string.Format("?SelectedIndex=" +

我试图在两页之间发送几个字符串。但是,接收页面仅将其解释为一个。关于如何解决这个问题的任何建议

第1页

private void button1_Click(object sender, RoutedEventArgs e)
        {
            string urlofdestinationpage = "/Page1.xaml";
            urlofdestinationpage += string.Format("?SelectedIndex=" + playersList.SelectedIndex);
            urlofdestinationpage += string.Format("?Player1=" + textBox1.Text);
            NavigationService.Navigate(new Uri(urlofdestinationpage, UriKind.Relative));
        }
第2页

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            IDictionary<string, string> x = this.NavigationContext.QueryString;
            String size = Convert.ToString(x["SelectedIndex"]);
            MessageBox.Show(size);
String player = Convert.ToString(x["Player1"]);
                MessageBox.Show(player1);
            base.OnNavigatedTo(e);
        }
受保护的覆盖无效OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
IDictionary x=this.NavigationContext.QueryString;
字符串大小=Convert.ToString(x[“SelectedIndex”]);
MessageBox.Show(大小);
字符串播放器=Convert.ToString(x[“Player1”]);
MessageBox.Show(player1);
基地。导航到(e);
}
接收页面输出消息“0?Player1=”并且不将Player1识别为值


有什么帮助吗?

您应该在第二个参数和任何附加参数后面加上¬?就像在URL:/Page1.xml中一样?param1=x¶m2=y

您的URI格式不正确。
表示参数的开头,每个参数必须用
分隔

您正在构造的URI是:

Page1.xaml?SelectedIndex=0?Player1=

您应该构造的URI是:

页面1.xaml?选择索引=0&Player1=

private void button1_Click(object sender, RoutedEventArgs e)
{
    string urlofdestinationpage = "/Page1.xaml";
    urlofdestinationpage += string.Format("?SelectedIndex=" + playersList.SelectedIndex);
    urlofdestinationpage += string.Format("&Player1=" + textBox1.Text);
    NavigationService.Navigate(new Uri(urlofdestinationpage, UriKind.Relative));
}