触控感应不同事件的处理:
可将以下三个事件,绑定到一个控件中。
/// <summary>
/// 触摸开始事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Page_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
//点击下的原点坐标
double x = e.ManipulationOrigin.X;
double y = e.ManipulationOrigin.Y;
} /// <summary>
/// 触摸过程事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Page_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
double x, y;
//当前操作的最近更改
x = e.DeltaManipulation.Translation.X;
y = e.DeltaManipulation.Translation.Y; //累计的Cumulative值
x = e.CumulativeManipulation.Translation.X;
y = e.CumulativeManipulation.Translation.Y; //获取线运动的速度
x = e.Velocities.LinearVelocity.X;
y = e.Velocities.LinearVelocity.Y;
} /// <summary>
/// 触摸结束事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Page_MniuplationCompleted(object sender, ManipulationCompletedEventArgs e)
{
double x, y;
//总的变化
x = e.TotalManipulation.Translation.X;
y = e.TotalManipulation.Translation.Y;
//最后线的速度
x = e.FinalVelocities.LinearVelocity.X;
y = e.FinalVelocities.LinearVelocity.Y; }