XAML:
<s:SurfaceSlider x:Name="MySurfaceSlider" ContactHoldGesture="MySurfaceSlider_ContactHoldGesture" />
C#, first option:
MySurfaceSlider.ContactHoldGesture += new ContactEventHandler(MySurfaceSlider_ContactHoldGesture);
C#, second option:
Contacts.AddContactHoldGestureHandler(MySurfaceSlider, MySurfaceSlider_ContactHoldGesture);
private void MySurfaceSlider_ContactHoldGesture(object sender, ContactEventArgs e)
{ /* TODO: Handle Contact Hold Gesture event */ }
There are several events that are possible to capture. The following section lists the contact events that are supported in the Surface SDK (version 1.0):
- ContactDown, which triggers when a contact is placed on a Surface control.
- ContactUp, which triggers when a contact is removed from a Surface control.
- ContactHoldGesture, which triggers when a Surface control is subject of a press-and-hold action. Note: Is only raised when the contact is of type Finger.
- ContactTapGesture, which triggers when a Surface control is being tapped on.
- ContactChanged, which triggers when a contact that is in touch with a Surface control changes its attributes, i.e. position.
- ContactEnter, which triggers when a contact enters a control’s boundaries, i.e. if a finger (that is already in touch with the Surface) is moved onto a control.
- ContactLeave, which triggers when contacts leaves a control’s boundaries.
Lastly I’ve posted a C# example of how to check what kind of contact is triggering a contact event.
Hi, I'm busy building a surface application at the moment, and I was wondering if you can tell me what ContactTapGesture is? I presumed it would be a ContactDown followed by a ContactUp within a short time period, but I can't seem to make it work. Do you have any idea?
SvaraRadera