DynamicRenderer.GetDispatcher Method

Returns a Dispatcher for the rendering thread.

Namespace:  System.Windows.Input.StylusPlugIns
Assembly:  PresentationCore (in PresentationCore.dll)

'Declaration
Protected Function GetDispatcher As Dispatcher

Return Value

Type: System.Windows.Threading.Dispatcher
A Dispatcher for the rendering thread.

The following example demonstrates how to use the GetDispatcher method to perform some work on the rendering thread.

Delegate Sub WorkerMethod()

Class CustomDynamicRenderer
    Inherits DynamicRenderer

    Protected Overrides Sub OnStylusDown(ByVal rawStylusInput As RawStylusInput)

        MyBase.OnStylusDown(rawStylusInput)
        rawStylusInput.NotifyWhenProcessed(Nothing)

    End Sub 'OnStylusDown


    Protected Overrides Sub OnStylusDownProcessed(ByVal callbackData As Object, ByVal targetVerified As Boolean)

        MyBase.OnStylusDownProcessed(callbackData, targetVerified)

        Dim renderingThreadDispatcher As Dispatcher = Me.GetDispatcher()
        renderingThreadDispatcher.BeginInvoke(DispatcherPriority.Normal, New WorkerMethod(AddressOf DoSomething))

    End Sub 'OnStylusDownProcessed


    Private Sub DoSomething()
        ' Perform work on the rendering thread. 
    End Sub 'DoSomething

End Class

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft