Know when Windows 10 are Tablet Mode - Windows 10 / Windows 10 Mobile

家住魔仙堡 提交于 2019-12-10 10:18:38

问题


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?

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?

Thanks


回答1:


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;
}


来源:https://stackoverflow.com/questions/33041370/know-when-windows-10-are-tablet-mode-windows-10-windows-10-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!