我已按照msdn关于GestureRecognizer的说明进行操作!处理捏客人。但是,我无法调用ManipulationUpdated
。有什么我想念的吗?
在我的C#
课程中,
`private GestureRecognizer gesture = new GestureRecognizer();`
在我的构造函数中:
gesture.GestureSettings = GestureSettings.ManipulationScale;
gesture.ManipulationUpdated += gesture_ManipulationUpdated;
gesture.ManipulationStarted += gesture_ManipulationStarted;
gesture.ManipulationCompleted += gesture_ManipulationCompleted;
在我的指针事件中:
private void PointerPressed_1(object sender, PointerRoutedEventArgs e)
{
var point = e.GetIntermediatePoints(null);
gesture.ProcessDownEvent(point[0]);
}
private void PointerMoved_1(object sender, PointerRoutedEventArgs e)
{
gesture.ProcessMoveEvents(e.GetIntermediatePoints(null));
}
private void PointerReleased_1(object sender, PointerRoutedEventArgs e)
{
var point = e.GetIntermediatePoints(null);
gesture.ProcessUpEvent(point[0]);
gesture.CompleteGesture();
}
void gesture_ManipulationCompleted(GestureRecognizer sender, ManipulationCompletedEventArgs args)
{
System.Diagnostics.Debug.WriteLine("Manipulation Completed {0}", args.Cumulative.Scale);
}
void gesture_ManipulationStarted(GestureRecognizer sender, ManipulationStartedEventArgs args)
{
System.Diagnostics.Debug.WriteLine("Manipulation Started {0}", args.Cumulative.Scale);
}
void gesture_ManipulationUpdated(GestureRecognizer sender, ManipulationUpdatedEventArgs args)
{
System.Diagnostics.Debug.WriteLine("Manipulation Updated {0}", args.Cumulative.Scale);
}
答案 0 :(得分:0)
尝试打开手势设置属性中的所有标志。如链接中所述:
gesture.gestureSettings =
Windows.UI.Input.GestureSettings.manipulationRotate |
Windows.UI.Input.GestureSettings.manipulationTranslateX |
Windows.UI.Input.GestureSettings.manipulationTranslateY |
Windows.UI.Input.GestureSettings.manipulationScale |
Windows.UI.Input.GestureSettings.manipulationRotateInertia |
Windows.UI.Input.GestureSettings.manipulationScaleInertia |
Windows.UI.Input.GestureSettings.manipulationTranslateInertia |
Windows.UI.Input.GestureSettings.tap;