# IDataTemplateComponent

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/templates/trait-idatatemplatecomponent/

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

```rust
trait IDataTemplateComponent
```

The bindings of a template instance, driven by the container that hosts the instance.

The container calls `process_bindings` with phase `0` when it
prepares the element for an item (before it assigns the data context), then with each phase
the previous call returned while it is positive, and `recycle` before the
element is reused for another item. Phase zero reads the bindings of the elements without a
phase; a later phase reads the bindings of the elements with that phase (`x:Phase`).

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

## Members

- [`process_bindings`](#function-process_bindings)
- [`recycle`](#function-recycle)

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

### process_bindings

```rust
fn process_bindings(self: &Self, data: Option<BoxedValue>, item_index: i32, current_phase: i32) -> i32
```

Reads the bindings of `current_phase` for `data`, the item at `item_index` (`-1` when the
container does not give it), and returns the next phase to process, or `-1` when there is
none.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/templates/i_data_template_component.rs#L28)

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

### recycle

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

Releases what the bindings listen to before the element is reused for another item; the
elements of the later phases are hidden again until their phase.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/templates/i_data_template_component.rs#L32)

## Availability

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