Answered by:
Navigation in Windows Phone 8.1 Silverlight

Question
-
Hi there,
Currently, I'm working on a Windows Phone 8.1 Silverlight application. But, I'm having trouble with page navigation. I want to navigate to a page with my parameters, but I don't know how. I know how to navigate to a page without parameters , but with parameters, I don't know.
Can anyone show me how to navigate to a page with parameters ? For example, I want to navigate to Page2.xaml with PhoneCamera object as a parameter.
Thank you :)
Answers
-
How to perform page navigation on Windows Phone 8
private void passParam_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text, UriKind.Relative)); }
get parameters from passed by previous page
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); string msg = ""; if (NavigationContext.QueryString.TryGetValue("msg", out msg)) textBlock1.Text = msg; }
在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。
- Marked as answer by Amy PengMicrosoft employee, Owner Wednesday, December 17, 2014 4:34 AM
-
there are some ways to do
(1) serialize the object to json or xml.
(2) by static propertites or fields in app.xaml.cs
(3) WP7 Master - Detail Navigation with Repository Pattern
(4) by PhoneApplicationService.State Property , How to navigate with objects in windows phone 8?
在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。
- Marked as answer by Amy PengMicrosoft employee, Owner Wednesday, December 17, 2014 4:34 AM
-
No directly way, the closest to your idea is serialization
在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。
- Marked as answer by Amy PengMicrosoft employee, Owner Wednesday, December 17, 2014 4:34 AM
All replies
-
How to perform page navigation on Windows Phone 8
private void passParam_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text, UriKind.Relative)); }
get parameters from passed by previous page
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); string msg = ""; if (NavigationContext.QueryString.TryGetValue("msg", out msg)) textBlock1.Text = msg; }
在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。
- Marked as answer by Amy PengMicrosoft employee, Owner Wednesday, December 17, 2014 4:34 AM
-
-
there are some ways to do
(1) serialize the object to json or xml.
(2) by static propertites or fields in app.xaml.cs
(3) WP7 Master - Detail Navigation with Repository Pattern
(4) by PhoneApplicationService.State Property , How to navigate with objects in windows phone 8?
在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。
- Marked as answer by Amy PengMicrosoft employee, Owner Wednesday, December 17, 2014 4:34 AM
-
-
No directly way, the closest to your idea is serialization
在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。
- Marked as answer by Amy PengMicrosoft employee, Owner Wednesday, December 17, 2014 4:34 AM