Windows10 UWP Back Button的处理

1,Making the Back button appear requires just one line of code:

SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

2,Responding to clicks of the Back button is a simple matter of wiring up a handler for SystemNavigationManager.BackRequested events:

SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) =>
{
    // TODO: Go back to the previous page
};

3,手机端back的事件处理:

if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
    BackButton.Visibility = Visibility.Collapsed;
    Windows.Phone.UI.Input.HardwareButtons.BackPressed += OnHardwareBackButtonPressed;
}

附: http://www.wintellect.com/devcenter/jprosise/handling-the-back-button-in-windows-10-uwp-apps

  

原文地址:https://www.cnblogs.com/wlqsmiling/p/5035971.html