# Design

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-design/

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

```rust
struct Design
```

Helper class for design-time property support.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`is_design_mode`](#function-is_design_mode)
- [`height_property`](#function-height_property)
- [`set_height`](#function-set_height)
- [`get_height`](#function-get_height)
- [`width_property`](#function-width_property)
- [`set_width`](#function-set_width)
- [`get_width`](#function-get_width)
- [`data_context_property`](#function-data_context_property)
- [`set_data_context`](#function-set_data_context)
- [`get_data_context`](#function-get_data_context)
- [`set_data_context_for_data_template`](#function-set_data_context_for_data_template)
- [`get_data_context_for_data_template`](#function-get_data_context_for_data_template)
- [`preview_with_property`](#function-preview_with_property)
- [`set_preview_with_template`](#function-set_preview_with_template)
- [`set_preview_with`](#function-set_preview_with)
- [`set_preview_with_template_for_data_template`](#function-set_preview_with_template_for_data_template)
- [`set_preview_with_for_data_template`](#function-set_preview_with_for_data_template)
- [`set_preview_with_template_for_style`](#function-set_preview_with_template_for_style)
- [`set_preview_with_for_style`](#function-set_preview_with_for_style)
- [`get_preview_with`](#function-get_preview_with)
- [`get_preview_with_for_data_template`](#function-get_preview_with_for_data_template)
- [`get_preview_with_for_style`](#function-get_preview_with_for_style)
- [`design_style_property`](#function-design_style_property)
- [`set_design_style`](#function-set_design_style)
- [`get_design_style`](#function-get_design_style)
- [`apply_design_mode_properties`](#function-apply_design_mode_properties)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L70)

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

### is_design_mode

```rust
fn is_design_mode() -> bool
```

Whether the application is running in design mode.

This property is set by the previewer when it hosts the application;
it is false in a running application.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L85)

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

### height_property

```rust
fn height_property() -> &'static AttachedProperty<f64>
```

Defines the `Height` attached property: a height for the control
that is applied at design time only.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L96)

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

### set_height

```rust
fn set_height(control: &Control, value: f64)
```

Sets the design-time height for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L105)

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

### get_height

```rust
fn get_height(control: &Control) -> f64
```

Gets the design-time height for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L110)

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

### width_property

```rust
fn width_property() -> &'static AttachedProperty<f64>
```

Defines the `Width` attached property: a width for the control
that is applied at design time only.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L114)

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

### set_width

```rust
fn set_width(control: &Control, value: f64)
```

Sets the design-time width for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L123)

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

### get_width

```rust
fn get_width(control: &Control) -> f64
```

Gets the design-time width for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L128)

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

### data_context_property

```rust
fn data_context_property() -> &'static AttachedProperty<Option<BoxedValue>>
```

Defines the `DataContext` attached property: a data context for
the control that is applied at design time only.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L132)

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

### set_data_context

```rust
fn set_data_context(control: &Control, value: Option<BoxedValue>)
```

Sets the design-time data context for a control.

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

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

### get_data_context

```rust
fn get_data_context(control: &Control) -> Option<BoxedValue>
```

Gets the design-time data context for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L146)

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

### set_data_context_for_data_template

```rust
fn set_data_context_for_data_template(control: &Rc<dyn IDataTemplate>, value: Option<BoxedValue>)
```

Sets the design-time data context for a data template.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L151)

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

### get_data_context_for_data_template

```rust
fn get_data_context_for_data_template(control: &Rc<dyn IDataTemplate>) -> Option<BoxedValue>
```

Gets the design-time data context for a data template.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L158)

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

### preview_with_property

```rust
fn preview_with_property() -> &'static AttachedProperty<Option<Ref<Control>>>
```

Defines the `PreviewWith` attached property: a control that
hosts the object in the previewer.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L163)

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

### set_preview_with_template

```rust
fn set_preview_with_template(target: &Ref<FerroObject>, template: Option<PreviewTemplate>)
```

Sets a preview template for the specified object at design time.

This method allows you to specify a substitute control template to
be used to preview the given object in the previewer.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L175)

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

### set_preview_with

```rust
fn set_preview_with(target: &Ref<FerroObject>, control: Option<Ref<Control>>)
```

Sets a preview control for the specified object at design time.

This method allows you to specify a substitute control to be used to
preview the given object in the previewer. A visual cannot be
previewed with a control: it needs a template.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L184)

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

### set_preview_with_template_for_data_template

```rust
fn set_preview_with_template_for_data_template(target: &Rc<dyn IDataTemplate>, template: Option<PreviewTemplate>)
```

Sets a preview template for the specified data template at design
time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L196)

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

### set_preview_with_for_data_template

```rust
fn set_preview_with_for_data_template(target: &Rc<dyn IDataTemplate>, control: Option<Ref<Control>>)
```

Sets a preview control for the specified data template at design
time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L205)

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

### set_preview_with_template_for_style

```rust
fn set_preview_with_template_for_style(target: &Rc<dyn IStyle>, template: Option<PreviewTemplate>)
```

Sets a preview template for the specified style at design time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L210)

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

### set_preview_with_for_style

```rust
fn set_preview_with_for_style(target: &Rc<dyn IStyle>, control: Option<Ref<Control>>)
```

Sets a preview control for the specified style at design time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L215)

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

### get_preview_with

```rust
fn get_preview_with(target: &FerroObject) -> Option<Ref<Control>>
```

Gets the preview control for the specified object at design time,
if one is set.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L221)

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

### get_preview_with_for_data_template

```rust
fn get_preview_with_for_data_template(target: &Rc<dyn IDataTemplate>) -> Option<Ref<Control>>
```

Gets the preview control for the specified data template at design
time, if one is set.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L227)

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

### get_preview_with_for_style

```rust
fn get_preview_with_for_style(target: &Rc<dyn IStyle>) -> Option<Ref<Control>>
```

Gets the preview control for the specified style at design time, if
one is set.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L233)

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

### design_style_property

```rust
fn design_style_property() -> &'static AttachedProperty<Option<DesignStyleValue>>
```

Defines the `DesignStyle` attached property for design-time use.

This property allows you to apply a style to a control only at
design-time, enabling custom visualizations or highlighting in
the designer without affecting the runtime appearance.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L237)

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

### set_design_style

```rust
fn set_design_style(control: &Control, value: Rc<dyn IStyle>)
```

Sets the design-time style for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L249)

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

### get_design_style

```rust
fn get_design_style(control: &Control) -> Option<Rc<dyn IStyle>>
```

Gets the design-time style for a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L254)

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

### apply_design_mode_properties

```rust
fn apply_design_mode_properties(target: &Control, source: &Control)
```

Applies the design-time properties set on `source` to `target`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/design.rs#L259)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `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`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)

## Availability

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