For example, I want a button to take me to a settings page, and then back to the main screen. Just as an example for me to understand the workflow. Any guidance?
+6
A:
I use the NavigationService
to navigate to the new page, where the Uri
has a path relative to the project's base directory.
private void OptionsMenuItem_Click(object sender, EventArgs e)
{
// Navigate to the new page
NavigationService.Navigate(new Uri("/Views/OptionsView.xaml", UriKind.Relative));
}
The back button on the phone will take the user back to the previous page automatically, or you could code you own return button using the NavigationService
again.
Dr Herbie
2010-09-20 05:14:50
Is this the standard way of doing it?
Serg
2010-09-20 13:11:53
This is the standard method as far as I know -- or should I say that it's the only method I've seen used in the training materials I have viewed.
Dr Herbie
2010-09-20 14:54:28
+2
A:
Dr. Herbie's method works great.
Another option is to implement INavigate on your PhoneApplicationPage. Then use a HyperlinkButton. If you have a lot of buttons and don't want to write a bunch of click handlers, this can be more convenient.
Your implementation of INavigate.Navigate just uses the page's NavigationService like this:
public bool Navigate(Uri source)
{
NavigationService.Navigate(source);
return true;
}
John Vert
2010-09-20 14:09:58