none
导航至新页面后按返回/后退键不能回到上一页 RRS feed

答案

  • 好吧,还是我自己给出解决方案:

            public MainPage()
            {
                this.InitializeComponent();
    #if WINDOWS_PHONE_APP
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
    #endif
                this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
            }
    #if WINDOWS_PHONE_APP
            void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
            {
                if (Frame.CanGoBack)
                {
                    e.Handled = true;
                    Frame.GoBack();
                }
            }
    #endif

    • 已标记为答案 MIC 2014 2014年11月9日 0:03
    2014年11月9日 0:03

全部回复

  • 好吧,还是我自己给出解决方案:

            public MainPage()
            {
                this.InitializeComponent();
    #if WINDOWS_PHONE_APP
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
    #endif
                this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
            }
    #if WINDOWS_PHONE_APP
            void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
            {
                if (Frame.CanGoBack)
                {
                    e.Handled = true;
                    Frame.GoBack();
                }
            }
    #endif

    • 已标记为答案 MIC 2014 2014年11月9日 0:03
    2014年11月9日 0:03
  • 好吧,还是我自己给出解决方案:

            public MainPage()
            {
                this.InitializeComponent();
    #if WINDOWS_PHONE_APP
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
    #endif
                this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
            }
    #if WINDOWS_PHONE_APP
            void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
            {
                if (Frame.CanGoBack)
                {
                    e.Handled = true;
                    Frame.GoBack();
                }
            }
    #endif

    你好,

    很高兴你的问题得到了解决:)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年11月11日 2:04
    版主