UIElement.ContextCanceled Event


Occurs when a context input gesture continues into a manipulation gesture, to notify the element that the context flyout should not be opened.

Equivalent WinUI event: Microsoft.UI.Xaml.UIElement.ContextCanceled.

// Register
event_token ContextCanceled(TypedEventHandler<UIElement, RoutedEventArgs const &> const& handler) const;

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

// Revoke with event_revoker
ContextCanceled_revoker ContextCanceled(auto_revoke_t, TypedEventHandler<UIElement, RoutedEventArgs const &> const& handler) const;
public event TypedEventHandler<UIElement,RoutedEventArgs> ContextCanceled;
function onContextCanceled(eventArgs) { /* Your code */ }
uIElement.addEventListener("contextcanceled", onContextCanceled);
uIElement.removeEventListener("contextcanceled", onContextCanceled);
- or -
uIElement.oncontextcanceled = onContextCanceled;
Public Custom Event ContextCanceled As TypedEventHandler(Of UIElement, RoutedEventArgs) 
<uiElement ContextCanceled="eventhandler"/>

Event Type


Windows 10 requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)


You typically handle this event for elements that can be manipulated by drag-and-drop. This event is raised when a ContextRequested event has been raised, but the element has not received a PointerReleased event before a manipulation begins. This indicates that the user intended to invoke a manipulation rather than a context flyout, so the context flyout should not be opened.

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

Applies to

See also