博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

使用C#开发Metro 风格应用的路线图 -- 触屏操作

Posted on 2012-05-01 23:06  淡如水wp  阅读(1403)  评论(4编辑  收藏  举报

win8支持多点触摸技术,而我们在屏幕上所做的各种操作,也最终转换为输入,包括

操作描述
Tap 一个指头轻点一下屏幕
Hold 一个指头按住屏幕不动
Drag 一个或多个指头按住屏幕并相相同的方向移动
Pinch 两个指头按住屏幕越来越近或越来越远
Rotate 两个批判按住屏幕做顺时或逆时针旋转
Cross-slide 一个指头按住一个对象向某个方向滑动.

 
在window runtime上响应触屏事件的方法分为两类:单点和多点。下面分别介绍:

单点事件包括:

PointerPressed
PointerReleased
PointerMoved
PointerEntered
PointerExited

这些事件的参数都是PointerEventArgs.

多点事件包括:

ClassDescription
ManipulationStarted Event Occurs when an input device begins a manipulation on the UIElement.
ManipulationDelta Event Occurs when the input device changes position during a manipulation.
ManipulationCompleted Event Occurs when a manipulation and inertia on the UIElement are complete.
ManipulationStartedEventArgs Provides data for the ManipulationStarted event.
ManipulationDeltaEventArgs Provides data for the ManipulationDelta event.
ManipulationVelocities Describes the speed at which manipulations occur.
ManipulationCompletedEventArgs Provides data for the ManipulationCompleted event.

当多点操作时,一般先触发 ManipulationStarted 事件,然后是一连串的ManipulationDelta事件触发,最后是ManipulationCompleted事件.
注:在模拟器可以用鼠标滚轮模拟

在UI上的设计要点

  • 显示标明用户正在操作的对象
  • 当平衡时带点加速和惯性效果
  • 使用捕捉点及其他方面的限制来帮助用户获取有用的对象