Tag: windows 10 mobile

处理后退导航Windows 10(UWP)

在我的Xaml页面中,我有一个Frame。 我正在尝试使用backButton事件来在框架内导航。 所以我试着用这段代码 public MainPage(){ this.InitializeComponent(); if(Windows.Foundation.Metadata.ApiInformation.IsTypePresent(“Windows.Phone.UI.Input.HardwareButtons”)) { Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed; } } private void HardwareButtons_BackPressed(object sender,BackPressedEventArgs e) { if(insideFrame.CanGoBack())insideFrame.GoBack(); else Application.Current.Exit(); } 但是在执行HardwareButtons_BackPressed事件后的手机中它会关闭应用程序。 它似乎在MainPage上运行一些默认的后退按钮行为… 我该如何解决? 在Windows10中,他们是否添加新事件来处理后退导航? [更新] 现在我发现在Windows 10中使用SystemNavigationManager而不是Input.HardwareButtons.BackPressed 。 SystemNavigationManager currentView = SystemNavigationManager.GetForCurrentView();