# Canvas

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-canvas/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct Canvas
```

A panel that displays child controls at arbitrary locations.

Unlike other [`Panel`](/docs/0.5.0/api/ferroui-controls/struct-panel/) implementations, the canvas doesn't lay out its
children in any particular layout. Instead, the positioning of each child
control is defined by the `Canvas.Left`, `Canvas.Top`, `Canvas.Right` and
`Canvas.Bottom` attached properties.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L16)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`arrange_child`](#function-arrange_child)
- [`left_property`](#function-left_property)
- [`top_property`](#function-top_property)
- [`right_property`](#function-right_property)
- [`bottom_property`](#function-bottom_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`get_left`](#function-get_left)
- [`set_left`](#function-set_left)
- [`get_top`](#function-get_top)
- [`set_top`](#function-set_top)
- [`get_right`](#function-get_right)
- [`set_right`](#function-set_right)
- [`get_bottom`](#function-get_bottom)
- [`set_bottom`](#function-set_bottom)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L20)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<Canvas>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L20)

<a id="function-arrange_child"></a>

### arrange_child

```rust
fn arrange_child(self: &Self, child: &Ref<Control>, final_size: Size)
```

Arranges a single child within the size allocated to the canvas.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L20)

<a id="function-left_property"></a>

### left_property

```rust
fn left_property() -> &'static AttachedProperty<f64>
```

Defines the `Left` attached property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L82)

<a id="function-top_property"></a>

### top_property

```rust
fn top_property() -> &'static AttachedProperty<f64>
```

Defines the `Top` attached property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L82)

<a id="function-right_property"></a>

### right_property

```rust
fn right_property() -> &'static AttachedProperty<f64>
```

Defines the `Right` attached property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L82)

<a id="function-bottom_property"></a>

### bottom_property

```rust
fn bottom_property() -> &'static AttachedProperty<f64>
```

Defines the `Bottom` attached property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L82)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L124)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L128)

<a id="function-get_left"></a>

### get_left

```rust
fn get_left(element: &FerroObject) -> f64
```

Gets the value of the `Left` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L133)

<a id="function-set_left"></a>

### set_left

```rust
fn set_left(element: &FerroObject, value: f64)
```

Sets the value of the `Left` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L138)

<a id="function-get_top"></a>

### get_top

```rust
fn get_top(element: &FerroObject) -> f64
```

Gets the value of the `Top` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L143)

<a id="function-set_top"></a>

### set_top

```rust
fn set_top(element: &FerroObject, value: f64)
```

Sets the value of the `Top` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L148)

<a id="function-get_right"></a>

### get_right

```rust
fn get_right(element: &FerroObject) -> f64
```

Gets the value of the `Right` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L153)

<a id="function-set_right"></a>

### set_right

```rust
fn set_right(element: &FerroObject, value: f64)
```

Sets the value of the `Right` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L158)

<a id="function-get_bottom"></a>

### get_bottom

```rust
fn get_bottom(element: &FerroObject) -> f64
```

Gets the value of the `Bottom` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L163)

<a id="function-set_bottom"></a>

### set_bottom

```rust
fn set_bottom(element: &FerroObject, value: f64)
```

Sets the value of the `Bottom` attached property for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/canvas.rs#L168)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`CanvasImplExt`](/docs/0.5.0/api/ferroui-controls/trait-canvasimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`PanelImplExt`](/docs/0.5.0/api/ferroui-controls/trait-panelimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<Canvas>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`PanelImpl`](/docs/0.5.0/api/ferroui-controls/trait-panelimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`CanvasImpl`](/docs/0.5.0/api/ferroui-controls/trait-canvasimpl/)
- [`INavigableContainer`](/docs/0.5.0/api/ferroui-base/input/trait-inavigablecontainer/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
