In my MainPage.xaml: area and btu have values inside the button function and I changed them to strings.
private void button1_Click(object sender, RoutedEventArgs e)
{
...
area.ToString();
btu.ToString();
NavigationService.Navigate(new Uri("/SolutionPage.xaml?msg1=" + area, UriKind.Relative));
NavigationService.Navigate(new Uri("/SolutionPage.xaml?msg2=" + btu, UriKind.Relative));
}
then, in page1.xaml, i have:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string msg1 = "";
if (NavigationContext.QueryString.TryGetValue("msg1", out msg1))
{
textBlock1.Text = String.Format("Area:{0}", msg1);
}
base.OnNavigatedTo(e);
string msg2 = "";
if (NavigationContext.QueryString.TryGetValue("msg2", out msg2))
{
textBlock2.Text = String.Format("BTU:{0}", msg2);
}
}
The problem is that only textBlock1 change (Area).
What should i do to pass btu.ToString() to textBlock2.text?
You should make the navigation request once, and append both values to it.
And in your
OnNavigatedTo, only call the base version once.