# StyledProperty

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/struct-styledproperty/

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

```rust
struct StyledProperty<T: PropertyValue>
```

A styled property: a property whose value is held by the property store
and can come from local values, styles, templates, animations, bindings and
inheritance, resolved by priority.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L21)

## Members

- [`as_property`](#function-as_property)
- [`validate_value`](#function-validate_value)
- [`add_owner`](#function-add_owner)
- [`add_owner_with`](#function-add_owner_with)
- [`coerce_value`](#function-coerce_value)
- [`get_default_value`](#function-get_default_value)
- [`get_default_value_for`](#function-get_default_value_for)
- [`get_metadata`](#function-get_metadata)
- [`get_metadata_for`](#function-get_metadata_for)
- [`override_default_value`](#function-override_default_value)
- [`override_default_value_for`](#function-override_default_value_for)
- [`override_metadata`](#function-override_metadata)
- [`override_metadata_for`](#function-override_metadata_for)
- [`unregister`](#function-unregister)

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

### as_property

```rust
fn as_property(self: &'static Self) -> &'static FerroProperty
```

The untyped base of the property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L89)

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

### validate_value

```rust
fn validate_value(self: &Self) -> Option<&dyn Fn(&T) -> bool>
```

The value validation callback for the property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L95)

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

### add_owner

```rust
fn add_owner<TOwner: ObjectType>(self: &'static Self) -> &'static Self
```

Registers the property on another class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L108)

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

### add_owner_with

```rust
fn add_owner_with<TOwner: ObjectType>(self: &'static Self, metadata: StyledPropertyMetadata<T>) -> &'static Self
```

Registers the property on another class, with metadata for that class.

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

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

### coerce_value

```rust
fn coerce_value(self: &Self, instance: &FerroObject, base_value: T) -> T
```

Coerces `base_value` with the coercion callback registered for the
type of `instance`, if any.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L122)

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

### get_default_value

```rust
fn get_default_value(self: &Self, type_: &'static TypeInfo) -> T
```

Gets the default value for the property on the specified type.

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

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

### get_default_value_for

```rust
fn get_default_value_for(self: &Self, owner: &FerroObject) -> T
```

Gets the default value for the property on the type of `owner`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L138)

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

### get_metadata

```rust
fn get_metadata(self: &Self, type_: &'static TypeInfo) -> Rc<StyledPropertyMetadata<T>>
```

Gets the property metadata for the specified type.

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

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

### get_metadata_for

```rust
fn get_metadata_for(self: &Self, owner: &FerroObject) -> Rc<StyledPropertyMetadata<T>>
```

Gets the property metadata for the type of `owner`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L169)

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

### override_default_value

```rust
fn override_default_value<TOwner: ObjectType>(self: &Self, default_value: T)
```

Overrides the default value for the property on class `TOwner`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L174)

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

### override_default_value_for

```rust
fn override_default_value_for(self: &Self, type_: &'static TypeInfo, default_value: T)
```

Overrides the default value for the property on the specified type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L179)

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

### override_metadata

```rust
fn override_metadata<TOwner: ObjectType>(self: &Self, metadata: StyledPropertyMetadata<T>)
```

Overrides the metadata for the property on class `TOwner`.

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

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

### override_metadata_for

```rust
fn override_metadata_for(self: &Self, type_: &'static TypeInfo, metadata: StyledPropertyMetadata<T>)
```

Overrides the metadata for the property on the specified type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L189)

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

### unregister

```rust
fn unregister(self: &Self, type_: &'static TypeInfo)
```

Removes the metadata registered for the specified type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styled_property.rs#L204)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`TypedProperty`](/docs/0.5.0/api/ferroui-base/trait-typedproperty/)
- [`Registrable`](/docs/0.5.0/api/ferroui-base/trait-registrable/)
- `Deref`

## Availability

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