# TemplateColumn

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls-treedatagrid/models/struct-templatecolumn/

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

```rust
struct TemplateColumn<M: TreeModel>
```

`TemplateColumn<TModel>`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L62)

## Members

- [`new`](#function-new)
- [`from_resource_keys`](#function-from_resource_keys)
- [`options`](#function-options)
- [`set_header`](#function-set_header)
- [`get_cell_template`](#function-get_cell_template)
- [`get_cell_editing_template`](#function-get_cell_editing_template)
- [`create_cell_of`](#function-create_cell_of)

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

### new

```rust
fn new(header: Option<BoxedValue>, cell_template: Rc<dyn IDataTemplate>, cell_editing_template: Option<Rc<dyn IDataTemplate>>, width: Option<GridLength>, options: Option<Rc<TemplateColumnOptions<M>>>) -> Rc<Self>
```

A column whose cells `cell_template` shows and `cell_editing_template` edits.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L74)

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

### from_resource_keys

```rust
fn from_resource_keys(header: Option<BoxedValue>, cell_template_resource_key: ResourceKey, cell_editing_template_resource_key: Option<ResourceKey>, width: Option<GridLength>, options: Option<Rc<TemplateColumnOptions<M>>>) -> Rc<Self>
```

A column whose cells the data template resource `cell_template_resource_key` shows and the
resource `cell_editing_template_resource_key` edits, looked up from the resources of the
cell the first time a cell is shown.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L90)

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

### options

```rust
fn options(self: &Self) -> &Rc<TemplateColumnOptions<M>>
```

The options of the column.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L136)

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

### set_header

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

Sets the column header.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L141)

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

### get_cell_template

```rust
fn get_cell_template(self: &Self, anchor: &Control) -> Rc<dyn IDataTemplate>
```

The template of the cells that are not editing.
## Panics
When the column's template resource cannot be found from `anchor` (`KeyNotFoundException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L149)

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

### get_cell_editing_template

```rust
fn get_cell_editing_template(self: &Self, anchor: &Control) -> Rc<dyn IDataTemplate>
```

The template of the cells that are editing.
## Panics
When the column has no editing template, or its resource cannot be found from `anchor`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L157)

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

### create_cell_of

```rust
fn create_cell_of(self: &Self, model: &Rc<M>) -> CellRef
```

The cell of `model`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/models/template_column.rs#L165)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`IViewColumn<M>`](/docs/0.5.0/api/ferroui-controls-treedatagrid/models/trait-iviewcolumn/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`INotifyPropertyChanged`](/docs/0.5.0/api/ferroui-base/data/model/use-inotifypropertychanged/)
- [`IColumn`](/docs/0.5.0/api/ferroui-controls-treedatagrid/models/trait-icolumn/)
- [`IUpdateColumnLayout`](/docs/0.5.0/api/ferroui-controls-treedatagrid/models/trait-iupdatecolumnlayout/)
- [`ICellColumn`](/docs/0.5.0/api/ferroui-controls-treedatagrid/models/trait-icellcolumn/)
- [`IColumnOf<M>`](/docs/0.5.0/api/ferroui-treedatagrid-core/models/trait-icolumnof/)
- [`IValueColumn<M>`](/docs/0.5.0/api/ferroui-treedatagrid-core/models/trait-ivaluecolumn/)

## Availability

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