了解 Windows 10 何时处于平板电脑模式 - Windows 10/Windows 10 Mobile [英] Know when Windows 10 are Tablet Mode - Windows 10 / Windows 10 Mobile

查看:35
本文介绍了了解 Windows 10 何时处于平板电脑模式 - Windows 10/Windows 10 Mobile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发适用于 Windows 10 和 Windows 10 移动版的通用应用.有谁知道如何检查 Windows 10 是否在平板电脑模式下运行?

I work on Universal App for Windows 10 and Windows 10 Mobile. Does anyone know how to check if Windows 10 is running on Tablet Mode?

我在这里发现了这个问题,但这是针对 Windows 窗体的:如何在 Windows 窗体应用程序中检测 Window 10 何时进入平板电脑模式?

I found this question here but that is for Windows Forms: How can I detect when Window 10 enters tablet mode in a Windows Forms application?

谢谢

推荐答案

查询 UserInteractionMode - 这是来自该链接的示例代码

You query the UserInteractionMode - this is the sample code from that link

switch(UIViewSettings.GetForCurrentView().UserInteractionMode)
{
  case UserInteractionMode.Mouse:
    VisualStateManager.GoToState(this, "MouseLayout", true);
    break;

  case UserInteractionMode.Touch:
  default:
    VisualStateManager.GoToState(this, "TouchLayout", true);
    break;
}

这篇关于了解 Windows 10 何时处于平板电脑模式 - Windows 10/Windows 10 Mobile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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