开发UAP的过程中,遇到如题问题,之前在Windows Phone时代,可以在App.xaml.cs 里对HardwareButtons.BackPressed进行监听,但是在UAP中,苦苦找寻不到相应对象,求助!
您好,
先在專案中加入"Windows Mobile Extensions for the UWP" reference後,就可以在App.xaml.cs加入下面的code去處理BackPressed事件
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
{
Windows.Phone.UI.Input.HardwareButtons.BackPressed += (s, e) =>
{
};
}