# TreeDataTemplate

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

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

```rust
struct TreeDataTemplate
```

A data template for hierarchical data, as markup declares it: besides
the control of an item it describes where the children of the item come
from.

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

## Members

- [`new`](#function-new)
- [`data_type`](#function-data_type)
- [`set_data_type`](#function-set_data_type)
- [`content`](#function-content)
- [`set_content`](#function-set_content)
- [`items_source`](#function-items_source)
- [`set_items_source`](#function-set_items_source)
- [`match_`](#function-match_)
- [`bind_children`](#function-bind_children)
- [`build`](#function-build)
- [`from_data_template`](#function-from_data_template)
- [`as_data_template`](#function-as_data_template)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L26)

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

### data_type

```rust
fn data_type(self: &Self) -> Option<ValueType>
```

The type of data the template is for. `None` matches all data.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L36)

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

### set_data_type

```rust
fn set_data_type(self: &Self, value: Option<ValueType>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L40)

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

### content

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

The template content: deferred content built for each item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L45)

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

### set_content

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



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

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

### items_source

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

The binding that selects the children of an item. It is assigned,
not applied: `bind_children` instantiates it
on the control that shows the children.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L56)

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

### set_items_source

```rust
fn set_items_source(self: &Self, value: Option<Rc<dyn BindingBase>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L60)

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

### match_

```rust
fn match_(self: &Self, data: Option<&BoxedValue>) -> bool
```

Whether the template is for `data`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L65)

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

### bind_children

```rust
fn bind_children(self: &Self, target: &FerroObject, target_property: &'static FerroProperty, _item: &BoxedValue) -> Rc<dyn IDisposable>
```

Binds the children of `item` to `target_property` of `target`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L73)

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

### build

```rust
fn build(self: &Self, data: Option<&BoxedValue>) -> Option<Ref<Control>>
```

Builds the control for `data` and gives it the data as its data
context.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L87)

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

### from_data_template

```rust
fn from_data_template(template: &Rc<dyn IDataTemplate>) -> Option<Rc<TreeDataTemplate>>
```

The template behind a data template handle, if it is one of this
class (the cast of the contract back to the class).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L99)

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

### as_data_template

```rust
fn as_data_template(self: &Self) -> Rc<dyn IDataTemplate>
```

The template as the data template contract.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/templates/tree_data_template.rs#L104)

## 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`
- [`ITemplateWithParam<Option<Rc<dyn AnyValue>>, Option<Ref<Control>>>`](/docs/0.5.0/api/ferroui-controls/templates/trait-itemplatewithparam/)
- [`IDataTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-idatatemplate/)
- [`ITreeDataTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-itreedatatemplate/)
- [`ITypedDataTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-itypeddatatemplate/)
- `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/).
