0

I want to access my page to setup the XAML Page:

Dim Pg As New PageListPickerSelection
Pg.StartCalculating(199,"Z-UU", MyCalculationDataIEnumList, myImageSource)
App.NavigationService.Navigate(New Uri("/uc/ListPicker/PageListPickerSelection.xaml", UriKind.Relative))

But NavigationService.Navigate does not support Objects or referenced pages.

How is the correct procedure to show the own page?

Or asked in another way: How does the "ListPicker in the WP7" solve this when showing his separated page?

Regards

Nasenbaer
  • 4,810
  • 11
  • 53
  • 86

2 Answers2

1

If I understand your question, you are asking how to configure a page before navigating to it, correct? The navigation service will create your pages as you navigate to them on the fly. It is not possible to give the navigation service the page as an object If you need to pass data into a page you can use the normal method of appending params to a URI as such (using c# as I am not familiar with VB):

NavigationService.Navigate(new Uri("/uc/ListPicker/PageListPickerSelection.xaml?Param1=" + (199).ToString() + "&Parm2=" + "Z-UU", UriKind.Relative));

Later in the PageListPickerSelection's OnNavigatedTo() method you can parse the parameters again as such:

string p1 = this.NavigationContext.QueryString["Param1"];
string p2 = this.NavigationContext.QueryString["Param2"];
Unknown1987
  • 1,671
  • 13
  • 30
  • Hi thanks. In WPF, I can navigate to my own created page. Problem on your solution is, that I cannot easy set an own class as property because I need to encode/decode all to a string to use querystrings. Because of that, is there another solution? – Nasenbaer Jan 06 '12 at 10:50
  • This is the official MS prescribed way of doing page navigation. http://msdn.microsoft.com/en-us/library/ff626521(v=VS.92).aspx If you are using some kind of application framework such as MVVM, you can store your params in the ViewModel or Model and access them once navigated to the page. Unfortunately thats what is exposed in WP7. – Unknown1987 Jan 06 '12 at 10:57
0

You could use a static class in which you have a couple of static values which you write when leaving the first page and read when opening the second page.

If you don't like static classes / variables you could use a singleton.

Marius Bughiu
  • 997
  • 14
  • 32