我需要检查运行我的应用程序的特定Windows设备是否有后退按钮,无论是在设备的硬件上还是软件上(平板电脑模式下的Windows10)。
有人能帮我吗?谢谢
发布于 2015-10-08 08:21:54
对于硬件的后退按钮,你可以使用ApiInformation.IsTypePresent方法很容易地检查它。
public MainPage()
{
this.InitializeComponent();
bool isHardwareButtonsAPIPresent =
Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons");
if(isHardwareButtonsAPIPresent)
{
// add Windows Mobile extenstions for UWP
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}
}
private void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
// hareware button pressed
}发布于 2015-10-09 03:13:12
根据MSDN的说法,后退按钮应该始终存在于:手机、平板电脑、Surface Hub。
至于桌面/笔记本电脑软件,可以启用/禁用应用程序标题栏中的按钮。您可以通过获取属性AppViewBackButtonVisibility来检查它是否可见
bool isSoftwareButton = SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility == AppViewBackButtonVisibility.Visible;https://stackoverflow.com/questions/32994721
复制相似问题