# PropertyHelper

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactivity/helpers/struct-propertyhelper/

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

```rust
struct PropertyHelper
```

Reads and writes the properties of objects by name: the registered properties of objects of
the class model (`Name`, and attached properties as `(Owner.Name)`), and the plain properties
of any value that declares them in its markup metadata.

Errors are the argument exceptions of the reference, as their messages.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/property_helper.rs#L21)

## Members

- [`try_set_temporary_ferro_property_value`](#function-try_set_temporary_ferro_property_value)
- [`is_direct_ferro_property`](#function-is_direct_ferro_property)
- [`update_property_value`](#function-update_property_value)
- [`try_get_property_value`](#function-try_get_property_value)

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

### try_set_temporary_ferro_property_value

```rust
fn try_set_temporary_ferro_property_value(target_object: &BoxedValue, property_name: &str, value: Option<&BoxedValue>) -> Result<Option<Rc<dyn IDisposable>>, String>
```

Sets a registered property of `target_object` with the animation priority, so that
disposing the returned handle reverts the change. `Ok(None)` when the target is not an
object, has no such property or the property is direct.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/property_helper.rs#L192)

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

### is_direct_ferro_property

```rust
fn is_direct_ferro_property(target_object: &BoxedValue, property_name: &str) -> bool
```

Whether `property_name` names a direct property of `target_object`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/property_helper.rs#L217)

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

### update_property_value

```rust
fn update_property_value(target_object: &BoxedValue, property_name: &str, value: Option<&BoxedValue>, preserve_value_source: bool) -> Result<bool, String>
```

Sets the property `property_name` of `target_object` to `value`, converting the value to
the type of the property (`preserve_value_source` sets the current value of a registered
property instead of its local value). Returns false when an attached property named
`(Owner.Name)` is not found.
## Errors
The property is not found, is read-only, or the value does not convert to its type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/property_helper.rs#L259)

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

### try_get_property_value

```rust
fn try_get_property_value(target_object: &BoxedValue, property_name: &str) -> Result<Option<(Option<BoxedValue>, bool)>, String>
```

Reads the property `property_name` of `target_object`: `Ok(Some((value,
preserve_value_source)))` when it is read (`preserve_value_source` is true for a registered
property), `Ok(None)` for an attached property that is not found or a plain property that
cannot be read.
## Errors
A plain property of the name is not found.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/property_helper.rs#L292)

## 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`

## Availability

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