# PropertyValidationBehavior

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactions-custom/struct-propertyvalidationbehavior/

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

```rust
struct PropertyValidationBehavior
```

Base behavior that validates a property value using a set of rules.

Deviation (DEVIATIONS.md, Behaviors): the reference class is generic over the type of the
associated control (`TControl`) and of the validated property (`TValue`); classes of the class
model are not generic, so both are runtime types given at creation
(`new_of``::<TControl, TValue>()`, `construct`): the associated
object is checked against the first as the reference does, and the property is validated only
when its value type is the second (`Property is FerroProperty<TValue>` of the reference).
The rules receive the value untyped (see [`IValidationRule`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-ivalidationrule/)).

Deviation (DEVIATIONS.md, Behaviors): markup cannot give a class of the object model type
arguments (`x:TypeArguments="TextBox, sys:String"`), so the behavior markup creates
(`new`) is attached to any object and validates the property
whatever the type of its value: the `PropertyValidationBehavior<FerroObject, object>` of the
reference, where every property is a property of `object`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L91)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`property_property`](#function-property_property)
- [`is_valid_property`](#function-is_valid_property)
- [`error_property`](#function-error_property)
- [`rules_property`](#function-rules_property)
- [`construct`](#function-construct)
- [`construct_untyped`](#function-construct_untyped)
- [`new_of`](#function-new_of)
- [`new`](#function-new)
- [`property`](#function-property)
- [`set_property`](#function-set_property)
- [`rules`](#function-rules)
- [`is_valid`](#function-is_valid)
- [`set_is_valid`](#function-set_is_valid)
- [`error`](#function-error)
- [`set_error`](#function-set_error)

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

### TYPE

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

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L98)

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<PropertyValidationBehavior>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L98)

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

### property_property

```rust
fn property_property() -> &'static StyledProperty<Option<&'static FerroProperty>>
```

Identifies the `Property` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L107)

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

### is_valid_property

```rust
fn is_valid_property() -> &'static StyledProperty<bool>
```

Identifies the `IsValid` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L107)

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

### error_property

```rust
fn error_property() -> &'static StyledProperty<Option<String>>
```

Identifies the `Error` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L107)

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

### rules_property

```rust
fn rules_property() -> &'static DirectProperty<PropertyValidationBehavior, ValidationRules>
```

Identifies the `Rules` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L107)

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

### construct

```rust
fn construct(associated_type: &'static TypeInfo, value_type: TypeId) -> Self
```

Creates the class data of a behavior attached to objects of `associated_type` (the
`TControl` of the reference) that validates a property whose value is of type `value_type`
(the `TValue` of the reference); see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L161)

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

### construct_untyped

```rust
fn construct_untyped() -> Self
```

Creates the class data of a behavior attached to any object that validates a property
whatever the type of its value (the behavior of markup, `new`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L167)

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

### new_of

```rust
fn new_of<TControl: StaticType, TValue: 'static>() -> Ref<Self>
```

Creates a behavior attached to objects of class `TControl` that validates a property whose
value is of type `TValue` (`new PropertyValidationBehavior<TControl, TValue>()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L173)

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

### new

```rust
fn new() -> Ref<Self>
```

Creates a behavior attached to any object that validates a property whatever the type of
its value (`new PropertyValidationBehavior<FerroObject, object>()` of the reference, the
form markup creates: `<PropertyValidationBehavior Property="{x:Static TextBox.TextProperty}">`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L180)

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

### property

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

Gets or sets the property to validate. This is a property of the object model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L185)

<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/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L189)

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

### rules

```rust
fn rules(self: &Self) -> ValidationRules
```

Gets validation rules collection. This is a property of the object model, and the content
of the behavior in markup.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L195)

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

### is_valid

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

Gets or sets value indicating whether the property value is valid. This is a property of
the object model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L201)

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

### set_is_valid

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L205)

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

### error

```rust
fn error(self: &Self) -> Option<String>
```

Gets or sets the validation error message. This is a property of the object model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L210)

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

### set_error

```rust
fn set_error(self: &Self, value: Option<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/validation/property_validation_behavior.rs#L214)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `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`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`DisposingBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingbehaviorimplext/)
- [`StyledElementBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimplext/)
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<PropertyValidationBehavior>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`DisposingBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingbehaviorimpl/)
- [`StyledElementBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimpl/)

## Availability

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