# ControlTemplate

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

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

```rust
struct ControlTemplate
```

The template of a templated control, as markup declares it.

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

## Members

- [`new`](#function-new)
- [`content`](#function-content)
- [`set_content`](#function-set_content)
- [`target_type`](#function-target_type)
- [`set_target_type`](#function-set_target_type)
- [`build`](#function-build)
- [`from_control_template`](#function-from_control_template)
- [`as_control_template`](#function-as_control_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/control_template.rs#L19)

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

### content

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

The template content: deferred content built for each control the
template is applied to.

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

<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/control_template.rs#L29)

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

### target_type

```rust
fn target_type(self: &Self) -> Option<&'static TypeInfo>
```

The type of control the template is for.

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

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

### set_target_type

```rust
fn set_target_type(self: &Self, value: Option<&'static TypeInfo>)
```



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

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

### build

```rust
fn build(self: &Self, _control: &Ref<TemplatedControl>) -> Option<TemplateResult<Ref<Control>>>
```

Builds the template for `control`.

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

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

### from_control_template

```rust
fn from_control_template(template: &Rc<dyn IControlTemplate>) -> Option<Rc<ControlTemplate>>
```

The template behind a control 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/control_template.rs#L49)

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

### as_control_template

```rust
fn as_control_template(self: &Self) -> Rc<dyn IControlTemplate>
```

The template as the control template contract.

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

## 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<Ref<TemplatedControl>, Option<TemplateResult<Ref<Control>>>>`](/docs/0.5.0/api/ferroui-controls/templates/trait-itemplatewithparam/)
- [`IControlTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-icontroltemplate/)
- `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/).
