# Panel

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

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

```rust
struct Panel
```

Base class for controls that can contain multiple children.

Controls can be added to a panel by adding them to its `children`
collection. All children are layed out to fill the panel.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`children_changed`](#function-children_changed)
- [`invalidate_measure_on_children_changed`](#function-invalidate_measure_on_children_changed)
- [`background_property`](#function-background_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`children`](#function-children)
- [`background`](#function-background)
- [`set_background`](#function-set_background)
- [`is_items_host`](#function-is_items_host)
- [`set_is_items_host`](#function-set_is_items_host)
- [`affects_parent_arrange`](#function-affects_parent_arrange)
- [`affects_parent_measure`](#function-affects_parent_measure)

<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/panel.rs#L33)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### children_changed

```rust
fn children_changed(self: &Self, e: &NotifyCollectionChangedEventArgs<'_, Ref<Control>>)
```

Called when the `children` collection changes.

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

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

### invalidate_measure_on_children_changed

```rust
fn invalidate_measure_on_children_changed(self: &Self)
```

Invalidates the measure of the panel after its children changed.

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

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

### background_property

```rust
fn background_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
```

Defines the `Background` property.

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

<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/panel.rs#L166)

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

### new

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



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

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

### children

```rust
fn children(self: &Self) -> Controls
```

The children of the panel.

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

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

### background

```rust
fn background(self: &Self) -> Option<Rc<dyn IBrush>>
```

A brush with which to paint the background.

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

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

### set_background

```rust
fn set_background(self: &Self, value: Option<Rc<dyn IBrush>>)
```



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

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

### is_items_host

```rust
fn is_items_host(self: &Self) -> bool
```

Whether this panel hosts the items created by an items presenter.

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

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

### set_is_items_host

```rust
fn set_is_items_host(self: &Self, value: bool)
```

Marks the panel as the host of the items created by an items
presenter: its children are then not its logical children.

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

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

### affects_parent_arrange

```rust
fn affects_parent_arrange<TPanel: ObjectType + Upcast<Panel>>(properties: &[&'static FerroProperty])
```

Marks a property on a child as affecting the parent panel's
arrangement: after a change to any of the properties on a control,
`invalidate_arrange` is called on its visual parent if that is a
`TPanel`.

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

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

### affects_parent_measure

```rust
fn affects_parent_measure<TPanel: ObjectType + Upcast<Panel>>(properties: &[&'static FerroProperty])
```

Marks a property on a child as affecting the parent panel's
measurement: after a change to any of the properties on a control,
`invalidate_measure` is called on its visual parent if that is a
`TPanel`.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`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<Panel>`](/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/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`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/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`PanelImpl`](/docs/0.5.0/api/ferroui-controls/trait-panelimpl/)

## Availability

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