Windows手机上的中断后退按钮

时间:2012-08-06 01:28:47

标签: c# windows-phone-7

当用户离开我的页面然后使用后退按钮返回页面时,我希望将它们重定向到另一个页面,有没有办法可以做到这一点?

1 个答案:

答案 0 :(得分:0)

是的,通过快速谷歌搜索或StackOverflow搜索,您将找到它。但是,因为我心情很好:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
    if (DecoderPrompt.IsOpen)         
    {
        e.Cancel = true;
        // Navigate to different page:
        NavigationService.Navigate(new Uri("/View/YourView.xaml", UriKind.Relative));
    }