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"/>

事件類型

備註

重要

PointerCaptureLost 可能會引發,而不是 PointerReleased。 請勿依賴 PointerPressedPointerReleased 事件一律以配對方式發生。 若要正常運作,您的應用程式必須接聽並處理代表 Press 動作可能結論的所有事件,以及包含 PointerCaptureLost 的事件。 指標可能會因為使用者互動而遺失擷取,或是因為您以程式設計方式擷取另一個指標,或刻意釋放目前的指標擷取。

成功擷取指標時,不會引發任何事件。 若要擷取指標,您可以呼叫 CapturePointer 方法,這通常是在其他指標事件之事件處理常式的內容中完成。 如需如何擷取指標以及如何執行此動作的詳細資訊,請參閱 CapturePointerMouse 互動

PointerCaptureLost 是路由事件。 如需路由事件概念的詳細資訊,請參閱 事件和路由事件概觀

PointerCaptureLost 支援將事件處理常式附加至將叫用的路由,即使事件的事件資料標示為 Handled 也一樣。 請參閱 AddHandler

適用於

另請參閱