CanvasAnimatedControlCreateCoreIndependentInputSource Method |
Namespace: Microsoft.Graphics.Canvas.UI.Xaml
public CoreIndependentInputSource CreateCoreIndependentInputSource( CoreInputDeviceTypes deviceTypes )
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.