# TargetPropertyPath

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

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

```rust
struct TargetPropertyPath
```

The target of a `Setter` of a visual state: an object and a property of it.

Markup writes it as the text of `Setter.Target`: `Element.Property` or
`Element.(Owner.Property)` for an attached property. The compiler keeps the name of the element
(`target_name`) and resolves the property against the type of the
element; the property is the `property` of the setter. The element
is found by its name in the name scope of the template or the document when the state is
applied, as WinUI's `CTargetPropertyPath` does (`m_targetName`, `ResolveTargetForVisualStateSetter`),
so a setter may name an element declared after it. An explicit `target`
object, set in code or markup, is used instead of the name (WinUI's manual target).

The target is held weakly: a setter of a visual state usually targets an element of the tree
that holds the visual states, and so the setter would keep that tree alive.

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

## Members

- [`empty`](#function-empty)
- [`new`](#function-new)
- [`target`](#function-target)
- [`set_target`](#function-set_target)
- [`target_name`](#function-target_name)
- [`set_target_name`](#function-set_target_name)
- [`path`](#function-path)
- [`set_path`](#function-set_path)
- [`property`](#function-property)
- [`set_property`](#function-set_property)

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

### empty

```rust
fn empty() -> Rc<Self>
```

Creates a path without a target or a property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L44)

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

### new

```rust
fn new(target: &FerroObject, property: &'static FerroProperty) -> Rc<Self>
```

Creates the path of `property` of `target` (WinUI's constructor that takes a property,
with the target set).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L50)

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

### target

```rust
fn target(self: &Self) -> Option<Ref<FerroObject>>
```

The target object, if it is set and alive.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L59)

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

### set_target

```rust
fn set_target(self: &Self, value: Option<Ref<FerroObject>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L63)

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

### target_name

```rust
fn target_name(self: &Self) -> String
```

The name of the target element, resolved in a name scope when the setter applies; empty
when the target is an explicit object or not set.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L69)

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

### set_target_name

```rust
fn set_target_name(self: &Self, value: impl Into<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L73)

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

### path

```rust
fn path(self: &Self) -> String
```

The text of the path of the property (`Property` or `(Owner.Property)`), as markup wrote
it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L79)

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

### set_path

```rust
fn set_path(self: &Self, value: impl Into<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L83)

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

### property

```rust
fn property(self: &Self) -> Option<&'static FerroProperty>
```

The property of the target, when the path is resolved. A setter of a visual state keeps
the resolved property in its own `Property`.

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

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

### set_property

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/target_property_path.rs#L93)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`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`
- `ErasedDestructor`
- `IntoEither`
- `Default`
- `PartialEq`
- `Debug`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

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