# MaxValueValidationRule

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

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

```rust
struct MaxValueValidationRule
```

Validation rule that checks that a value is less than or equal to a maximum value.

Deviation (DEVIATIONS.md, Behaviors): the reference class is generic over the type `T` of the
value (`MaxValueValidationRule<T>`, created in markup with `x:TypeArguments`); classes of the
class model are not generic, so the maximum is an untyped value, compared with the validated
value by the ordering of untyped values (`ValueTypes::compare`, which converts the maximum to
the type of the value: a maximum given as text in markup compares as a number with a number).
An unset maximum is null (the reference's default of a value type `T` is its zero), and values
that do not compare are not valid (the comparer of the reference throws).

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`max_value_property`](#function-max_value_property)
- [`error_message_property`](#function-error_message_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`max_value`](#function-max_value)
- [`set_max_value`](#function-set_max_value)
- [`error_message`](#function-error_message)
- [`set_error_message`](#function-set_error_message)
- [`validate`](#function-validate)

<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/rules/max_value_validation_rule.rs#L25)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### max_value_property

```rust
fn max_value_property() -> &'static StyledProperty<Option<BoxedValue>>
```

Identifies the `MaxValue` property.

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

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

### error_message_property

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

Identifies the `ErrorMessage` property.

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

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

### construct

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

Creates the class data; see `ferroui_base::FerroObject::construct`.

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

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

### new

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

Creates a rule.

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

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

### max_value

```rust
fn max_value(self: &Self) -> Option<BoxedValue>
```

Gets or sets the maximum value. This is a property of the object model.

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

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

### set_max_value

```rust
fn set_max_value(self: &Self, value: Option<BoxedValue>)
```



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

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

### error_message

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

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

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

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

### set_error_message

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



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

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

### validate

```rust
fn validate(self: &Self, value: Option<&BoxedValue>) -> bool
```

Validates the specified value: valid when it is not null and not above the maximum.

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

## 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/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<MaxValueValidationRule>`](/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/)
- [`IValidationRule`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-ivalidationrule/)

## Availability

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