开发者

How can I manage different screens on a Windows Phone 7 application?

For example, I want a button to take me to a settings开发者_Go百科 page, and then back to the main screen. Just as an example for me to understand the workflow. Any guidance?


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'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;
    }


You must take care of certification requirements! Look at this tutorial: http://www.yourwindowsphone7.com/tutorials/navigation-in-windows-phone-7-apps.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜