如何处理为 UWP 按下的后退按钮 [英] How to handle back button pressed for UWP

查看:27
本文介绍了如何处理为 UWP 按下的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经在 Windows Phone 8.1 XAML 中使用硬件按钮 API.但是,在 UWP 中,某些设备没有后退按钮.我如何适应新的应用模型?

I used to use hardware button API in Windows Phone 8.1 XAML. However, in UWP some devices don't have back button. How do I adapt to the new app model?

推荐答案

你可以使用 BackRequested 事件来处理返回请求:

you can use BackRequested event to handle back request:

SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

if (App.MasterFrame.CanGoBack)
{
    rootFrame.GoBack();
    e.Handled = true;
}

这篇关于如何处理为 UWP 按下的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆