Dela via


UIElement.PointerCanceled Event

Definition

Occurs when a pointer that made contact abnormally loses contact.

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

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

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

Event Type

Remarks

Some of the reasons why you might get a PointerCanceled occurrence are:

  • User actions that change the relationship of the display area, such as changing resolution or monitor settings
  • Input interactions such as a stylus touching the same surface as a previous touch action
  • The user logs off or similar interruptions that aren't app-specific
  • The number of simultaneous contacts exceeded the number supported by the device

Important

PointerCanceled might fire instead of PointerReleased. Don't rely on PointerPressed and PointerReleased events always occurring in pairs. To function properly, your app must listen for and handle all events that represent the possible conclusions to a Press action, and that includes PointerCanceled.

If PointerCanceled fires, any pointer captures by that pointer are released. For more info on pointer capture, see CapturePointer.

When handling a PointerCanceled event, anticipate that some of the event data normally available for a pointer event won't be meaningful in the PointerRoutedEventArgs object you get through your handler. For example, the Position of the pointer is invalid because the pointer no longer exists.

PointerCanceled is a routed event. For more info on the routed event concept, see Events and routed events overview.

PointerCanceled supports the ability to attach event handlers to the route that will be invoked even if the event data for the event is marked Handled. See AddHandler.

Applies to

See also