Answered by:
Navigation or new a page in WP8.1 ?

Question
-
I am having a mainpage.xaml contains a appbar is assigned from a reusable page(ToolboxDeviceSelectionControlPage).
this.BottomAppBar = new ToolboxDeviceSelectionControlPage().BottomAppBar;
After using the ToolboxDeviceSelectionControlPage, I need to return a object to the mainpage. How can I do this?
I tried to use Fram.Navigate(MainPage, object). it crashes and throw: Object reference not set to an instance of an object.
Jiajun Qiu
- Edited by JIAJUN.QIU Wednesday, October 22, 2014 2:47 PM
Wednesday, October 22, 2014 1:36 PM
Answers
-
Actually it is not about a navigation.
Since I never navigate away from my mainpage, what I have done is assign a appbar usercontrol to mainpage, as the code I stated, so mainpage is running on a appbar instance created by
new ToolboxDeviceSelectionControlPage().
Finally I found out that I can register all event on my mainpage by using FindName to retrieve those controls back in runtime. I dont know if this is a correct way to do it. Feels quite strange though.....
Jiajun Qiu
- Proposed as answer by gferyt gfdh Friday, October 31, 2014 3:21 AM
- Marked as answer by Amy PengMicrosoft employee Friday, November 7, 2014 2:41 AM
Thursday, October 23, 2014 12:20 PM
All replies
-
What is your actual code?
It sounds like either the page or the object is null. What is the object and did you instantiate it?
The code should be more like this:
this.Frame.Navigate(typeof(MainPage), myObject);
I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.
Thursday, October 23, 2014 2:38 AM -
Hi JIAJUN.QIU,
Based on your description, I know that you want to pass Object during the navigation, then please try to check the following article which tells the detailed information:
#How to Pass Objects when Navigating between pages in Windows Phone 8.1 Runtime App:
http://mobileosgeek.com/how-to-pass-objects-when-navigating-between-pages-in-windows-phone-8-1-xaml-app/ .Best Regards,
Amy Peng
This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Thursday, October 23, 2014 3:36 AM -
Actually it is not about a navigation.
Since I never navigate away from my mainpage, what I have done is assign a appbar usercontrol to mainpage, as the code I stated, so mainpage is running on a appbar instance created by
new ToolboxDeviceSelectionControlPage().
Finally I found out that I can register all event on my mainpage by using FindName to retrieve those controls back in runtime. I dont know if this is a correct way to do it. Feels quite strange though.....
Jiajun Qiu
- Proposed as answer by gferyt gfdh Friday, October 31, 2014 3:21 AM
- Marked as answer by Amy PengMicrosoft employee Friday, November 7, 2014 2:41 AM
Thursday, October 23, 2014 12:20 PM -
Yes it is a correct way.Friday, October 31, 2014 3:21 AM