了解何时启用Windows 10平板模式 - Windows 10 / Windows 10 Mobile

3
2个回答

5

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

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

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

用户交互模式为Touch时,默认应该是触摸模式。 :) - Alan Yao - MSFT

0

我认为下面的代码可以帮助你:

UIViewSettings^ uiViewSettings = UIViewSettings::GetForCurrentView();
UserInteractionMode mode = uiViewSettings->UserInteractionMode;
switch (mode)
{
case UserInteractionMode::Touch:
  // PC is in tablet mode or other touch-first environment
  break;

case UserInteractionMode::Mouse:
  // PC is not in tablet mode or other mouse-first environment
  break;
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接