# IResourceDictionary

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

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

```rust
trait IResourceDictionary: IResourceProvider
```

An indexed dictionary of resources.

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

## Members

- [`merged_dictionaries`](#function-merged_dictionaries)
- [`merged_dictionaries_snapshot`](#function-merged_dictionaries_snapshot)
- [`theme_dictionaries_snapshot`](#function-theme_dictionaries_snapshot)
- [`count`](#function-count)
- [`add`](#function-add)
- [`set`](#function-set)
- [`contains_key`](#function-contains_key)
- [`remove`](#function-remove)
- [`try_get_value`](#function-try_get_value)
- [`clear`](#function-clear)

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

### merged_dictionaries

```rust
fn merged_dictionaries(self: &Self) -> FerroList<Rc<dyn IResourceProvider>>
```

The collection of child resource dictionaries, shared with the dictionary:
a change to the list is a change to the dictionary. The default, for a
dictionary that keeps no such list, is a new list with the providers of
`merged_dictionaries_snapshot`, which
the dictionary does not see change.

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

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

### merged_dictionaries_snapshot

```rust
fn merged_dictionaries_snapshot(self: &Self) -> Rc<Vec<Rc<dyn IResourceProvider>>>
```

A snapshot of the collection of child resource dictionaries.

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

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

### theme_dictionaries_snapshot

```rust
fn theme_dictionaries_snapshot(self: &Self) -> Vec<(ThemeVariant, Rc<dyn IThemeVariantProvider>)>
```

A snapshot of the collection of resource providers used for specific
theme variants.

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

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

### count

```rust
fn count(self: &Self) -> usize
```

The number of resources in the dictionary itself.

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

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

### add

```rust
fn add(self: &Self, key: ResourceKey, value: ResourceValue)
```

Adds a resource. Panics if the key is already present.

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

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

### set

```rust
fn set(self: &Self, key: ResourceKey, value: ResourceValue)
```

Adds or replaces a resource.

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

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

### contains_key

```rust
fn contains_key(self: &Self, key: &ResourceKey) -> bool
```

Whether the dictionary itself contains the key.

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

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

### remove

```rust
fn remove(self: &Self, key: &ResourceKey) -> bool
```

Removes a resource. Returns whether it was present.

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

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

### try_get_value

```rust
fn try_get_value(self: &Self, key: &ResourceKey) -> Option<ResourceValue>
```

Gets a resource of the dictionary itself.

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

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

### clear

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

Removes all resources of the dictionary itself.

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

## Availability

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