# DynamicResourceExtension

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-markup-xaml/markup_extensions/struct-dynamicresourceextension/

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

```rust
struct DynamicResourceExtension
```

`{DynamicResource Key}`: a binding to a resource, which follows changes
of the resources and of the theme variant.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/markup_extensions/dynamic_resource_extension.rs#L18)

## Members

- [`new`](#function-new)
- [`with_resource_key`](#function-with_resource_key)
- [`resource_key`](#function-resource_key)
- [`set_resource_key`](#function-set_resource_key)
- [`provide_value`](#function-provide_value)
- [`as_binding`](#function-as_binding)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/markup_extensions/dynamic_resource_extension.rs#L34)

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

### with_resource_key

```rust
fn with_resource_key(resource_key: Option<BoxedValue>) -> Rc<Self>
```

Creates the extension with a resource key.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/markup_extensions/dynamic_resource_extension.rs#L46)

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

### resource_key

```rust
fn resource_key(self: &Self) -> Option<BoxedValue>
```

The key of the resource: text, a type or any other value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/markup_extensions/dynamic_resource_extension.rs#L53)

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

### set_resource_key

```rust
fn set_resource_key(self: &Self, value: Option<BoxedValue>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/markup_extensions/dynamic_resource_extension.rs#L57)

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

### provide_value

```rust
fn provide_value(self: &Self, service_provider: &Rc<dyn IServiceProvider>) -> Rc<DynamicResourceExtension>
```

Captures the context of the place the extension is declared in (the
anchor to find resources from, the theme variant of a theme
dictionary, the priority inside a control template) and returns the
extension itself: it is the binding.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/markup_extensions/dynamic_resource_extension.rs#L76)

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

### as_binding

```rust
fn as_binding(self: &Self) -> Rc<dyn BindingBase>
```

The extension as the binding contract.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/markup_extensions/dynamic_resource_extension.rs#L93)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`BindingBase`](/docs/0.5.0/api/ferroui-base/data/trait-bindingbase/)
- `PartialEq`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

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