Click or drag to resize
CanvasAnimatedControlCreateCoreIndependentInputSource Method
Creates an input source that can process input on a non-UI thread (such as the game loop thread).

Namespace:  Microsoft.Graphics.Canvas.UI.Xaml
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0
Syntax
C#
public CoreIndependentInputSource CreateCoreIndependentInputSource(
	CoreInputDeviceTypes deviceTypes
)

Parameters

deviceTypes
Type: Windows.UI.CoreCoreInputDeviceTypes

Return Value

Type: CoreIndependentInputSource

Implements

ICanvasAnimatedControlCreateCoreIndependentInputSource(CoreInputDeviceTypes)
Remarks

This method calls through to SwapChainPanel.CreateCoreIndependentInputSource. The CoreIndependentInputSource can be used to process input events on any thread. It is important that CreateCoreIndependentInputSource is called on the thread that you want the events to be processed on.

If the input source is created on the game loop thread then CanvasAnimatedControl is already managing a CoreDispatcher and ensuring it processes events. If it is created on some other thread, then it is up to you to ensure that the input source's Dispatcher processes events. See the CoreIndependentInputSource documentation for more information.

In general, we recommend that you use CanvasAnimatedControl's standard pointer events, such as PointerPressed, PointerMoved etc. These can be found in the UserControl documentation. These events will be raised from the UI thread and so care must be taken if the handler accesses data that may also be used by the Update or Draw handlers.

The CustomFonts example in ExampleGallery demonstrates using CoreIndependentInputSource with GestureRecognizer on a CanvasAnimatedControl.

See Also