Reputation: 4063
In my project I got a page NotePage.xaml it has a textbox named TextBoxTitle and a textbox named TextBoxTheNote.
In the code-behind of another page, I make an instance of this page and fill in both textboxes. What I can't seem to figure out is: how do I navigate to that instance?
I don't have any kind of uri or anything.
Any thoughts?
Upvotes: 1
Views: 63
Reputation: 9857
With windows phone you don't create an instance of a page and navigate to it. You just navigate to the page you need and pass in the values through a series of different methods.
First navigations
NavigationService.Navigate(new Uri("YourXamlPageName.Xaml", UriKind.RelativeOrAbsolute));
Now that we have you navigating here comes the fun part.
Deciding how you want to pass your data.
There are a number of ways.
First you can embed it in the URI
NavigationService.Navigate(new Uri("YourXamlPageName.Xaml?pageTitle=Whatever", UriKind.RelativeOrAbsolute));
Then retrieve it in the navigated to of the other page
You can also serialize your data and retrive it on the other side.
You can use the EZ_Iso.dll for this. Very simple and fast. Great for complex objects http://anthonyrussell.info/postpage.php?name=2
Finally another method of passing data is through the Phone Application Service dictionary Outlined here in this blog post
http://anthonyrussell.info/postpage.php?name=10
Which ever way you choose just make sure to be consistent so it keeps your code clean.
Good luck!
Upvotes: 1