[英]Windows Phone 8.1 Universal Apps: ManipulationCompleted event doesn't fire
I'm writing a universal application for WP8.1 and W8.1. 我正在为WP8.1和W8.1编写通用应用程序。
I have a Rectangle in my XAML: 我的XAML中有一个矩形:
<Rectangle
Fill="Tomato"
Width="300"
Height="300"
ManipulationMode="All"
ManipulationStarting="UIElement_OnManipulationStarting"
ManipulationCompleted="UIElement_OnManipulationCompleted"
/>
But ManipulationCompleted fires only if I do some movement across rectangle. 但是,仅当我在矩形上进行一些移动时,ManipulationCompleted才会触发。 If I do just simple tap, then only ManipulationStarting fires. 如果我只做简单的点击,那么只有ManipulationStarting会触发。
What's wrong? 怎么了?
I used PointerReleased event instead of ManipulationCompleted event. 我使用了PointerReleased事件而不是ManipulationCompleted事件。 It happens when you release your finger from Rectangle. 当您从矩形松开手指时,会发生这种情况。
Also you can use PointerCaptureLost event. 您也可以使用PointerCaptureLost事件。
First off, you need to set the ManipulationDelta
event, in order to do some drag and drop. 首先,您需要设置ManipulationDelta
事件,以便进行一些拖放。 ManipulationDelta
is raised when a second touch point is placed on the UIElement and when this touch point changes position. 当第二个接触点放置在UIElement上并且此接触点更改位置时,将提高ManipulationDelta
。
The ManipulationCompleted
event is raised when the user leaves his finger or fingers from the UIElement and when any inertia applied to the element is complete. 当用户将一个或多个手指从UIElement上移开并且施加到该元素的惯性完成时,将引发ManipulationCompleted
事件。 If you only have one touching point with a single tap, like you describe, no movement takes place, no velocities are applied and no manipulation happened in the first place. 如您所描述的,如果您只有一个触碰点,那么就不会发生移动,没有施加速度并且首先不会进行任何操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.