簡體   English   中英

Windows Phone 8.1通用應用程序:ManipulationCompleted事件不會觸發

[英]Windows Phone 8.1 Universal Apps: ManipulationCompleted event doesn't fire

我正在為WP8.1和W8.1編寫通用應用程序。

我的XAML中有一個矩形:

<Rectangle 
    Fill="Tomato"
    Width="300"
    Height="300"
    ManipulationMode="All"
    ManipulationStarting="UIElement_OnManipulationStarting"
    ManipulationCompleted="UIElement_OnManipulationCompleted"
/>

但是,僅當我在矩形上進行一些移動時,ManipulationCompleted才會觸發。 如果我只做簡單的點擊,那么只有ManipulationStarting會觸發。

怎么了?

我使用了PointerReleased事件而不是ManipulationCompleted事件。 當您從矩形松開手指時,會發生這種情況。

您也可以使用PointerCaptureLost事件。

首先,您需要設置ManipulationDelta事件,以便進行一些拖放。 當第二個接觸點放置在UIElement上並且此接觸點更改位置時,將提高ManipulationDelta

當用戶將一個或多個手指從UIElement上移開並且施加到該元素的慣性完成時,將引發ManipulationCompleted事件。 如您所描述的,如果您只有一個觸碰點,那么就不會發生移動,沒有施加速度並且首先不會進行任何操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM