GestureRecognizer Class
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
'Declaration Public NotInheritable Class GestureRecognizer Inherits DependencyObject Implements IDisposable 'Usage Dim instance As GestureRecognizer
public final class GestureRecognizer extends DependencyObject implements IDisposable
public final class GestureRecognizer extends DependencyObject implements IDisposable
You cannot use this class in XAML.
A GestureRecognizer identifies an ink gesture. You can set the GestureRecognizer to recognize all or a subset of application gestures. To set the GestureRecognizer to recognize a subset of the available gestures, pass an ApplicationGesture array to the constructor or use the SetEnabledGestures method. To determine whether a StrokeCollection contains a gesture, call the Recognize method.
The following example demonstrates how to determine whether a Stroke is a Scratchout gesture.
Private Function InterpretScratchoutGesture(ByVal stroke As Stroke) As Boolean ' Attempt to instantiate a recognizer for scratchout gestures. Dim gestures() As ApplicationGesture = {ApplicationGesture.ScratchOut} Dim recognizer As New GestureRecognizer(gestures) If Not recognizer.IsRecognizerAvailable Then Return False End If ' Determine if the stroke was a scratchout gesture. Dim gestureStrokes As StrokeCollection = New StrokeCollection() gestureStrokes.Add(stroke) Dim results As ReadOnlyCollection(Of GestureRecognitionResult) results = recognizer.Recognize(gestureStrokes) If results.Count = 0 Then Return False End If ' Results are returned sorted in order strongest-to-weakest; ' we need only analyze the first (strongest) result. If (results(0).ApplicationGesture = ApplicationGesture.ScratchOut) Then ' Use the scratchout stroke to perform hit-testing and ' erase existing strokes, as necessary. Return True Else ' Not a gesture: display the stroke normally. Return False End If End Function
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Ink.GestureRecognizer
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.