UIElement.DoubleTapped Event

Definition

Occurs when an otherwise unhandled DoubleTap interaction occurs over the hit test area of this element.

public:
 virtual event DoubleTappedEventHandler ^ DoubleTapped;
// Register
event_token DoubleTapped(DoubleTappedEventHandler const& handler) const;

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

// Revoke with event_revoker
UIElement::DoubleTapped_revoker DoubleTapped(auto_revoke_t, DoubleTappedEventHandler const& handler) const;
public event DoubleTappedEventHandler DoubleTapped;
function onDoubleTapped(eventArgs) { /* Your code */ }
uIElement.addEventListener("doubletapped", onDoubleTapped);
uIElement.removeEventListener("doubletapped", onDoubleTapped);
- or -
uIElement.ondoubletapped = onDoubleTapped;
Public Custom Event DoubleTapped As DoubleTappedEventHandler 
<uiElement DoubleTapped="eventhandler"/>

Event Type

Remarks

A DoubleTap interaction is simply two Tap interactions that occur in quick succession. The exact timing of what the system interprets as a double tap is adjustable by users through system settings.

See Touch interaction design for more info on how to use a DoubleTap interaction in your app design.

If a user interaction also fires DoubleTapped, Tapped will fire first to represent the first tap, but the second tap won't fire an additional Tapped. If you want different logic for Tapped versus DoubleTapped, your Tapped handler may need to use app-specific variables and a timer in order to avoid running on interactions that are eventually interpreted as a DoubleTap action.

A DoubleTapped event represents a gesture, whereas a PointerPressed event is a lower-level input event. DoubleTapped and PointerPressed events can fire as the result of a single user interaction. Even if a control is already handling pointer events in the control logic, or is handling manipulations, that doesn't prevent DoubleTapped from firing.

A DoubleTapped event is potentially the result of more than one pointer point. For the higher-level gesture events like DoubleTapped you no longer have immediate access to PointerPoint details such as individual PointerId values or individual coordinates. You do have access to device type (PointerDeviceType) and for coordinates you can call GetPosition, which gives an average of the coordinates for a DoubleTap from more than one pointer point.

DoubleTapped is a routed event. Also, an element must have IsDoubleTapEnabled be true to be a DoubleTapped event source (true is the default). It is possible to handle DoubleTapped on parent elements even if IsDoubleTapEnabled is false on the parent element, if the event bubbles to a parent from an event source child element where IsDoubleTapEnabled is false. For more info on the routed event concept, see Events and routed events overview.

For touch actions and also for interaction-specific or manipulation events that are consequences of a touch action, an element must be hit-test visible in order to be the event source and fire the event that is associated with the action. UIElement.Visibility must be Visible. Other properties of derived types also affect hit-test visibility. For more info, see Events and routed events overview.

DoubleTapped 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.

Specific Windows Runtime controls may have class-based handling for the DoubleTapped input event. If so, the control probably has an override for the method OnDoubleTapped. Typically the event is marked handled by the class handler, and the DoubleTapped event is not raised for handling by any user code handlers on that control. For more info on how class-based handling for events works, see Events and routed events overview.

Applies to

See also