# StaticResourceExtension

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

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

```rust
struct StaticResourceExtension
```

`{StaticResource Key}`: looks a resource up once, when the document is
loaded, in the resource nodes above the place it is used.

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

## 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)

<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/static_resource_extension.rs#L26)

<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/static_resource_extension.rs#L31)

<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/static_resource_extension.rs#L38)

<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/static_resource_extension.rs#L42)

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

### provide_value

```rust
fn provide_value(self: &Self, service_provider: &Rc<dyn IServiceProvider>) -> Result<Option<BoxedValue>, XamlLoadError>
```

The resource. If it is not found and the target is a control that is
still being initialised, the lookup is repeated when the control is
initialised and the unset value marker is returned for now.

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

## 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`
- `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/).
