2 つのページ間で複数の文字列を送信しようとしています。ただし、受信ページはそれを 1 つとして解釈するだけです。これを修正する方法についてのアドバイス。
ページ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);
}
受信ページは「0?Player1=」というメッセージを出力し、player1 を値として認識しません。
何か助けはありますか?