# FerroProperty

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

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

```rust
struct FerroProperty
```

Base class for properties: the untyped identity and description of a
property that can be set on a [`FerroObject`](/docs/0.5.0/api/ferroui-base/struct-ferroobject/).

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

## Members

- [`as_property_info`](#function-as_property_info)
- [`bind`](#function-bind)
- [`host_type`](#function-host_type)
- [`name`](#function-name)
- [`property_type`](#function-property_type)
- [`property_type_name`](#function-property_type_name)
- [`owner_type`](#function-owner_type)
- [`inherits`](#function-inherits)
- [`is_attached`](#function-is_attached)
- [`is_direct`](#function-is_direct)
- [`is_read_only`](#function-is_read_only)
- [`assign_binding`](#function-assign_binding)
- [`set_assign_binding`](#function-set_assign_binding)
- [`id`](#function-id)
- [`changed`](#function-changed)
- [`get_metadata`](#function-get_metadata)
- [`get_metadata_for`](#function-get_metadata_for)
- [`unregister`](#function-unregister)
- [`is_valid_value`](#function-is_valid_value)
- [`as_styled`](#function-as_styled)
- [`unset_value`](#function-unset_value)
- [`register`](#function-register)
- [`register_with`](#function-register_with)
- [`register_attached`](#function-register_attached)
- [`register_attached_with`](#function-register_attached_with)
- [`register_direct`](#function-register_direct)
- [`register_direct_with`](#function-register_direct_with)

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

### as_property_info

```rust
fn as_property_info(self: &'static Self) -> std::rc::Rc<dyn IPropertyInfo>
```

The property as a shared property description
(`Rc<dyn IPropertyInfo>`), for the places that take a registered
property through the property description contract.
`IPropertyInfo::as_ferro_property` gives the property back.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/i_property_info.rs#L155)

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

### bind

```rust
fn bind(self: &'static Self) -> IndexerDescriptor
```

Gets a description of a binding to the property, for the binding
indexer of `FerroObject`. This is the `!` operator of a property:
`!Border.BackgroundProperty` is `Border::background_property().bind()`,
and the two-way forms `!!Property` and `~Property` are
`!Property.bind()`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/indexer_descriptor.rs#L84)

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

### host_type

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

The class an attached property is declared for: the `THost` of its
registration, the type of the objects its accessors (`GetX`/`SetX`)
take. `None` for properties that are not attached.

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

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

### name

```rust
fn name(self: &Self) -> &str
```

The name of the property.

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

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

### property_type

```rust
fn property_type(self: &Self) -> TypeId
```

The type of the property's value.

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

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

### property_type_name

```rust
fn property_type_name(self: &Self) -> &'static str
```

The Rust type name of the property's value type.

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

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

### owner_type

```rust
fn owner_type(self: &Self) -> &'static TypeInfo
```

The class that registered the property.

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

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

### inherits

```rust
fn inherits(self: &Self) -> bool
```

Whether the property inherits its value.

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

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

### is_attached

```rust
fn is_attached(self: &Self) -> bool
```

Whether this is an attached property.

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

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

### is_direct

```rust
fn is_direct(self: &Self) -> bool
```

Whether this is a direct property.

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

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

### is_read_only

```rust
fn is_read_only(self: &Self) -> bool
```

Whether this is a readonly property.

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

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

### assign_binding

```rust
fn assign_binding(self: &Self) -> bool
```

Whether a binding given for this property in markup is assigned to
the property as its value rather than bound to it (the "assign
binding" attribute of the managed property). The property's value
type is then a binding type. A fact about the definition: it is the
same for every owner and is not part of the metadata.

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

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

### set_assign_binding

```rust
fn set_assign_binding(self: &Self, value: bool)
```

Marks the property as one that bindings are assigned to. Part of the
definition of the property: call it where the property is registered
(styled and attached properties state it through
`StyledPropertyOptions::assign_binding`).

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

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

### id

```rust
fn id(self: &Self) -> u32
```

An integer ID that uniquely identifies the property; shared by all
owners added with `add_owner`.

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

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

### changed

```rust
fn changed(self: &'static Self) -> &'static PropertyChangedObservable
```

Notifications of changes to this property on any object.

The handlers are invoked after the object's own change handling.

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

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

### get_metadata

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

Gets the base metadata of the property on the specified type.

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

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

### get_metadata_for

```rust
fn get_metadata_for(self: &Self, owner: &FerroObject) -> FerroPropertyMetadata
```

Gets the base metadata of the property on the type of `owner`.

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

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

### unregister

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

Removes the metadata registered for the property on the specified
type.

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

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

### is_valid_value

```rust
fn is_valid_value(self: &Self, value: &dyn Any) -> bool
```

Checks whether `value` is valid for the property: of the property's
value type and accepted by its validation callback.

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

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

### as_styled

```rust
fn as_styled<T: crate::PropertyValue>(self: &'static Self) -> Option<&'static StyledProperty<T>>
```

The property as a styled (or attached) property with value type `T`:
the typed view needed to read, set and bind it without boxing.
`None` for direct properties and when `T` is not the property's value
type.

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

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

### unset_value

```rust
fn unset_value() -> BoxedValue
```

The marker value that represents an unset property value.

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

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

### register

```rust
fn register<TOwner: ObjectType, TValue: PropertyValue>(name: &str, default_value: TValue) -> &'static StyledProperty<TValue>
```

Registers a styled property with a default value.

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

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

### register_with

```rust
fn register_with<TOwner: ObjectType, TValue: PropertyValue>(name: &str, options: StyledPropertyOptions<TValue>) -> &'static StyledProperty<TValue>
```

Registers a styled property.

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

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

### register_attached

```rust
fn register_attached<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>(name: &str, default_value: TValue) -> &'static AttachedProperty<TValue>
```

Registers an attached property with a default value.

`TOwner` is the class that registers the property and `THost` the class
of objects the property can be set on.

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

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

### register_attached_with

```rust
fn register_attached_with<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>(name: &str, options: StyledPropertyOptions<TValue>) -> &'static AttachedProperty<TValue>
```

Registers an attached property.

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

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

### register_direct

```rust
fn register_direct<TOwner: ObjectType, TValue: PropertyValue>(name: &str, getter: fn(&TOwner) -> TValue, setter: Option<fn(&TOwner, TValue) -> ()>, unset_value: TValue) -> &'static DirectProperty<TOwner, TValue>
```

Registers a direct property: a property whose value is stored in a
field of the owner and accessed through a getter and setter.

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

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

### register_direct_with

```rust
fn register_direct_with<TOwner: ObjectType, TValue: PropertyValue>(name: &str, getter: fn(&TOwner) -> TValue, setter: Option<fn(&TOwner, TValue) -> ()>, metadata: DirectPropertyMetadata<TValue>) -> &'static DirectProperty<TOwner, TValue>
```

Registers a direct property with explicit metadata.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- [`IPropertyInfo`](/docs/0.5.0/api/ferroui-base/data/core/trait-ipropertyinfo/)
- `PartialEq`
- `Eq`
- `Hash`
- `Debug`
- `Display`
- [`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/).
