Table of Contents

Interface IRenderControl

Namespace
OFT.Rendering.Control
Assembly
OFT.Rendering.dll

UI control that hosts a render surface: it raises Render to draw a frame and translates the input of the UI framework (classic WPF RenderControl or the ATAS X Avalonia SkiaRenderControl) into framework-neutral events. Mouse event coordinates are in physical pixels of the canvas.

public interface IRenderControl
Extension Methods

Properties

AllowControlDrop

Gets or sets whether the control accepts drag-and-drop; enables the RenderControlDrag* events.

Added in ATAS 8.0.15.

bool AllowControlDrop { get; set; }

Property Value

bool

CanvasSize

Gets the size of the drawing canvas in physical pixels: the control size multiplied by the DPI scale.

Size CanvasSize { get; }

Property Value

Size

VsyncEnabled

Gets or sets whether presentation is synchronized with the monitor refresh rate. In classic WPF the value is passed to the render surface; in ATAS X it is stored only, because the native Skia host owns the presentation sync.

bool VsyncEnabled { get; set; }

Property Value

bool

Methods

DeInit()

Releases the render surface. The control does not render after this call.

void DeInit()

DoDragDrop(object)

Starts a drag-and-drop operation from the control with the copy effect. In ATAS X the operation is started only from a pointer event and data stays in-process.

Added in ATAS 8.0.15.

void DoDragDrop(object data)

Parameters

data object

Object to drag.

GetData(object, Type)

Extracts the dragged object of type format from the data object of a drag event (Data).

Added in ATAS 8.0.15.

object? GetData(object data, Type format)

Parameters

data object

Data object received in a drag event.

format Type

Expected type of the dragged object.

Returns

object

The dragged object, or null when data does not contain an object of that type.

InvalidateAsync()

Requests a new frame. Can be called from any thread; repeated requests are coalesced into one render pass.

Task InvalidateAsync()

Returns

Task

A task that completes when the requested pass is processed (classic WPF) or when the request reaches the UI thread (ATAS X). In classic WPF a control covered by another window returns a completed task without rendering.

InvalidateVisual()

Invalidates the control. In ATAS X it requests a repaint of the native Skia surface, the same as InvalidateAsync(); in classic WPF it is the WPF element invalidation of the control.

void InvalidateVisual()

Invoke(Action)

Runs invoke synchronously on the UI thread of the control with render priority.

void Invoke(Action invoke)

Parameters

invoke Action

Action to run.

InvokeAsync(Action)

Queues invoke to the UI thread of the control with render priority.

Task InvokeAsync(Action invoke)

Parameters

invoke Action

Action to run.

Returns

Task

A task that completes after the action has run.

SetCursor(StdCursor)

Sets the mouse cursor over the control. Default implementation keeps custom IRenderControl implementations source-compatible.

Added in ATAS 8.0.15.

void SetCursor(StdCursor cursor)

Parameters

cursor StdCursor

Events

Render

Raised on each frame with the render context to draw into.

event Action<RenderContext> Render

Event Type

Action<RenderContext>

RenderControlDragDrop

Raised when dragged data is dropped on the control.

Added in ATAS 8.0.15.

event RenderControlDragEventHandler RenderControlDragDrop

Event Type

RenderControlDragEventHandler

RenderControlDragEnter

Raised when dragged data enters the control; set Effects to accept or reject the drop.

Added in ATAS 8.0.15.

event RenderControlDragEventHandler RenderControlDragEnter

Event Type

RenderControlDragEventHandler

RenderControlDragLeave

Raised when dragged data leaves the control.

Added in ATAS 8.0.15.

event EventHandler RenderControlDragLeave

Event Type

EventHandler

RenderControlDragOver

Raised while dragged data moves over the control; set Effects to accept or reject the drop.

Added in ATAS 8.0.15.

event RenderControlDragEventHandler RenderControlDragOver

Event Type

RenderControlDragEventHandler

RenderControlLoaded

Raised when the control is loaded into the visual tree, including after a docking change.

Added in ATAS 8.0.15.

event EventHandler RenderControlLoaded

Event Type

EventHandler

RenderControlMouseCaptureChanged

Raised when the control gets or loses the mouse capture. Not raised in ATAS X.

event EventHandler<RenderControlMouseCaptureEventArgs> RenderControlMouseCaptureChanged

Event Type

EventHandler<RenderControlMouseCaptureEventArgs>

RenderControlMouseClick

Raised for a click: in classic WPF after every RenderControlMouseUp; in ATAS X after a right button release and on a left button tap.

event RenderControlMouseEventHandler RenderControlMouseClick

Event Type

RenderControlMouseEventHandler

RenderControlMouseDoubleClick

Raised on a double click.

event RenderControlMouseEventHandler RenderControlMouseDoubleClick

Event Type

RenderControlMouseEventHandler

RenderControlMouseDown

Raised when a mouse button is pressed over the control.

event RenderControlMouseEventHandler RenderControlMouseDown

Event Type

RenderControlMouseEventHandler

RenderControlMouseEnter

Raised when the pointer enters the control.

event EventHandler RenderControlMouseEnter

Event Type

EventHandler

RenderControlMouseLeave

Raised when the pointer leaves the control.

event EventHandler RenderControlMouseLeave

Event Type

EventHandler

RenderControlMouseMove

Raised when the pointer moves over the control or while the mouse is captured.

event RenderControlMouseEventHandler RenderControlMouseMove

Event Type

RenderControlMouseEventHandler

RenderControlMouseUp

Raised when a mouse button is released.

event RenderControlMouseEventHandler RenderControlMouseUp

Event Type

RenderControlMouseEventHandler

RenderControlMouseWheel

Raised when the mouse wheel is rotated; see Delta and PreciseDelta.

event RenderControlMouseEventHandler RenderControlMouseWheel

Event Type

RenderControlMouseEventHandler

RenderControlResize

Raised when the size of the control changes.

event EventHandler RenderControlResize

Event Type

EventHandler

RenderControlShowContextMenu

Raised on a right mouse button release when the control has no own context menu and the release was not handled. Not raised in ATAS X.

event RenderControlMouseEventHandler RenderControlShowContextMenu

Event Type

RenderControlMouseEventHandler