了解Windows 10何时是平板电脑模式 – Windows 10 / Windows 10 Mobile

我在Universal App for Windows 10和Windows 10 Mobile上工作。 有谁知道如何检查Windows 10是否在平板电脑模式下运行?

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

谢谢

您查询UserInteractionMode – 这是该链接的示例代码

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