Windows Phone 7 passing multiple items between pages
-
Hi, I am building a simple windows phone 7 app. I need to pass more that one data item between pages. I know you need to make a small change to sending one data item across but im not sure what this change is. Currently I send one item across like this:
phoneApplicationPage.NavigationService.Navigate(new Uri("/Pages/View_Stickies.xaml?string=" + info, UriKind.RelativeOrAbsolute));
Where in this case info is the string sent. I unpack it on page 2 like this:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (this.NavigationContext.QueryString.ContainsKey("string")) { string GPS = this.NavigationContext.QueryString\["string"\]; MessageBox.Show(GPS); } base.OnNavigatedTo(e); }
Im sure there is a very simple answer to the question and any help would be great. Thanks
-
Hi, I am building a simple windows phone 7 app. I need to pass more that one data item between pages. I know you need to make a small change to sending one data item across but im not sure what this change is. Currently I send one item across like this:
phoneApplicationPage.NavigationService.Navigate(new Uri("/Pages/View_Stickies.xaml?string=" + info, UriKind.RelativeOrAbsolute));
Where in this case info is the string sent. I unpack it on page 2 like this:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (this.NavigationContext.QueryString.ContainsKey("string")) { string GPS = this.NavigationContext.QueryString\["string"\]; MessageBox.Show(GPS); } base.OnNavigatedTo(e); }
Im sure there is a very simple answer to the question and any help would be great. Thanks
As you are passing a query string across, all you need to do is add the second key value pair after a &, so your example could become:
string.Format("/Pages/View_Stickies.xaml?string={0}&id={1}", info, id)
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
-
As you are passing a query string across, all you need to do is add the second key value pair after a &, so your example could become:
string.Format("/Pages/View_Stickies.xaml?string={0}&id={1}", info, id)
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
Thank you very much.
-
Thank you very much.
You're welcome.
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads