# IResourceHost

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/controls/trait-iresourcehost/

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

```rust
trait IResourceHost: IResourceNode
```

Represents an element which hosts resources.

Implemented by [`StyledElement`](/docs/0.5.0/api/ferroui-base/struct-styledelement/) and by the application object, the root
of the styling-parent chain.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_resource_host.rs#L12)

## Members

- [`resources_changed`](#function-resources_changed)
- [`notify_hosted_resources_changed`](#function-notify_hosted_resources_changed)
- [`as_style_host`](#function-as_style_host)
- [`as_theme_variant_host`](#function-as_theme_variant_host)

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

### resources_changed

```rust
fn resources_changed(self: &Self, handler: Rc<dyn Fn(&ResourcesChangedEventArgs) -> ()>) -> Rc<dyn IDisposable>
```

Raised when the resources change on the element or an ancestor of the
element. Disposing the returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_resource_host.rs#L15)

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

### notify_hosted_resources_changed

```rust
fn notify_hosted_resources_changed(self: &Self, e: ResourcesChangedEventArgs)
```

Notifies the resource host that one or more of its hosted resources
has changed.

This method will be called automatically by the framework, you should
not need to call this method yourself. It is called when the resources
hosted by this element have changed, and is usually called by a
resource dictionary or style hosted by the element in response to a
resource being added or removed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_resource_host.rs#L25)

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

### as_style_host

```rust
fn as_style_host(self: &Self) -> Option<&dyn IStyleHost>
```

The host as a style host, if it is one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_resource_host.rs#L28)

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

### as_theme_variant_host

```rust
fn as_theme_variant_host(self: &Self) -> Option<&dyn IThemeVariantHost>
```

The host as a theme variant host, if it is one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_resource_host.rs#L33)

## Trait implementations

- [`IResourceHost`](/docs/0.5.0/api/ferroui-base/controls/trait-iresourcehost/)

## Availability

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