GestureRecognizer Class
Recognizes ink gestures.
Assembly: PresentationCore (in PresentationCore.dll)
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Ink.GestureRecognizer
| Name | Description | |
|---|---|---|
![]() | GestureRecognizer() | Initializes a new instance of the GestureRecognizer class. |
![]() | GestureRecognizer(IEnumerable(Of ApplicationGesture)) | Initializes a new instance of the GestureRecognizer class. |
| Name | Description | |
|---|---|---|
![]() | DependencyObjectType | Gets the DependencyObjectType that wraps the CLR type of this instance. (Inherited from DependencyObject.) |
![]() | Dispatcher | Gets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.) |
![]() | IsRecognizerAvailable | Gets a Boolean that indicates whether the gesture recognizer is available on the user's system. |
![]() | IsSealed | Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.) |
| Name | Description | |
|---|---|---|
![]() | CheckAccess() | Determines whether the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.) |
![]() | ClearValue(DependencyProperty) | Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.) |
![]() | ClearValue(DependencyPropertyKey) | Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.) |
![]() | CoerceValue(DependencyProperty) | Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.(Inherited from DependencyObject.) |
![]() | Dispose() | Releases all resources used by the GestureRecognizer. |
![]() | Equals(Object) | Determines whether a provided DependencyObject is equivalent to the current DependencyObject.(Inherited from DependencyObject.) |
![]() | GetEnabledGestures() | Gets the gestures that the GestureRecognizer recognizes. |
![]() | GetHashCode() | Gets a hash code for this DependencyObject.(Inherited from DependencyObject.) |
![]() | GetLocalValueEnumerator() | Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.) |
![]() | GetType() | |
![]() | GetValue(DependencyProperty) | Returns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.) |
![]() | InvalidateProperty(DependencyProperty) | Re-evaluates the effective value for the specified dependency property(Inherited from DependencyObject.) |
![]() | ReadLocalValue(DependencyProperty) | Returns the local value of a dependency property, if it exists. (Inherited from DependencyObject.) |
![]() | Recognize(StrokeCollection) | Looks for gestures in the specified StrokeCollection. |
![]() | SetCurrentValue(DependencyProperty, Object) | Sets the value of a dependency property without changing its value source. (Inherited from DependencyObject.) |
![]() | SetEnabledGestures(IEnumerable(Of ApplicationGesture)) | Sets the application gestures that the GestureRecognizer recognizes. |
![]() | SetValue(DependencyProperty, Object) | Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.) |
![]() | SetValue(DependencyPropertyKey, Object) | Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.) |
![]() | ShouldSerializeProperty(DependencyProperty) | Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.(Inherited from DependencyObject.) |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
![]() | VerifyAccess() | Enforces that the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.) |
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.
You cannot use this class in XAML.
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
Available since 3.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


