Click or drag to resize
CanvasVirtualControlCreateDrawingSession Method
Returns a new drawing session for updating a region of the control.

Namespace:  Microsoft.Graphics.Canvas.UI.Xaml
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version:
public CanvasDrawingSession CreateDrawingSession(
	Rect updateRectangle


Type: Windows.FoundationRect

Return Value

Type: CanvasDrawingSession

The specified region of the image is cleared to the ClearColor before this method returns. The region is in device independent pixels (DIPs). Regions that need to be updated are provided by the InvalidatedRegions property passed to the RegionsInvalidated event handler.

CreateDrawingSession may be called on any thread, but the returned drawing session must be disposed on the UI thread. If you want to move your drawing work to a different thread, either:

  1. On an arbitrary non-UI thread:
  2. Back on the UI thread:
    • drawingSession.Dispose()


  1. On the UI thread:
  2. Move to an arbitrary non-UI thread:
  3. Back on the UI thread:
    • drawingSession.Dispose()
See Also