UIElement.PointerCaptureLost 事件

定義

當該元素先前持有的指標捕獲移至其他元素或其他位置時,會發生此現象。

public:
 virtual event PointerEventHandler ^ PointerCaptureLost;
// Register
event_token PointerCaptureLost(PointerEventHandler const& handler) const;

// Revoke with event_token
void PointerCaptureLost(event_token const* cookie) const;

// Revoke with event_revoker
UIElement::PointerCaptureLost_revoker PointerCaptureLost(auto_revoke_t, PointerEventHandler const& handler) const;
public event PointerEventHandler PointerCaptureLost;
function onPointerCaptureLost(eventArgs) { /* Your code */ }
uIElement.addEventListener("pointercapturelost", onPointerCaptureLost);
uIElement.removeEventListener("pointercapturelost", onPointerCaptureLost);
- or -
uIElement.onpointercapturelost = onPointerCaptureLost;
Public Custom Event PointerCaptureLost As PointerEventHandler 
<uiElement PointerCaptureLost="eventhandler"/>

事件類型

備註

Important

PointerCaptureLost 可能觸發,而不是 PointerReleased。 不要只依賴 PointerPressedPointerReleased 事件總是成對發生。 為了正常運作,你的應用程式必須監聽並處理所有代表 新聞 行動可能結果的事件,其中包括 PointerCaptureLost。 指標可能會因為使用者互動而失去擷取,或是你程式化擷取了另一個指標,或是故意釋放了當前指標擷取。

當指標成功捕獲時,不會觸發任何事件。 要擷取指標,你會呼叫 CapturePointer 方法,這通常會在事件處理程序中執行,針對其他指標事件。 關於如何捕捉指標以及為什麼要這麼做,請參考 CapturePointerHttpsor Interactions

PointerCaptureLost 是路由事件。 欲了解更多路由事件概念,請參閱 事件與路由事件總覽

PointerCaptureLost 支援即使事件資料標記 為已處理,也能將事件處理器附加到將被呼叫的路由上。 請參見 AddHandler

適用於

另請參閱