Click or drag to resize
CanvasDeviceGetSharedDevice Method
Gets a device that can be shared between multiple different rendering components, such as controls.

Namespace:  Microsoft.Graphics.Canvas
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version:
public static CanvasDevice GetSharedDevice()

Return Value

Type: CanvasDevice

This overload defaults to choosing a hardware accelerated device.

Before being returned, the device is checked for whether it is lost. If it is lost, RaiseDeviceLost is called on the device, and then it is re-created.

It is not usually a good idea to call Dispose on a shared device, as this will break any other code that may be sharing it. Only dispose a shared device if you are certain that no other components are using it. After a shared device is disposed, subsequent calls to GetSharedDevice will replace it with a new device.

GetSharedDevice will fail if the DebugLevel property has been modified in between calls to GetSharedDevice. Generally, the debug level should be set before the first shared device is created.

See Also