The hold gesture is performed by touching the screen while continuing contact for a period of time (see Figure 12.5).
The UIElement.Hold
event is raised when the user touches the screen for one second.
An event handler for the Hold
event is shown in the following excerpt:
void HandleHold(object sender, GestureEventArgs e)
{
textBlock.Text = "hold";
}
As an aside, the UIElement Hold
event is used by the Windows Phone Toolkit’s ContextMenu
component. When used in this way, the hold gesture mimics the right-click of a mouse.
Note
UIElement
and Windows Phone Toolkit gesture events (discussed in the next section) are raised only if the UIElement
is detected beneath the touch point. Make sure that the Background
property of the UIElement
is not null. If a background is not defined, touch events pass through the host control, and gestures are not detected. To achieve a see-through background, while still maintaining gesture support, set the background property of the UIElement
to Transparent.
18.221.13.11