# IValueConverter

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/data/converters/trait-ivalueconverter/

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

```rust
trait IValueConverter
```

Converts a binding value.

Values are untyped: `None` is null, and a converter may return the unset
marker (`FerroProperty::unset_value`)
to make the binding use its fallback value, the do-nothing marker
(`BindingOperations::do_nothing`)
to leave the target untouched, or a boxed
`BindingNotification` to report an
error. Returning `Err` is the equivalent of throwing from the converter:
the binding logs the error and treats the value as unset.

`culture` is the culture to use: the converter culture of the binding,
or the current culture when the binding names none.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/converters/i_value_converter.rs#L19)

## Members

- [`convert`](#function-convert)
- [`convert_back`](#function-convert_back)

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

### convert

```rust
fn convert(self: &Self, value: Option<&BoxedValue>, target_type: ValueType, parameter: Option<&BoxedValue>, culture: &CultureInfo) -> Result<Option<BoxedValue>, BindingError>
```

Converts a value on its way from the binding source to the target.

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

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

### convert_back

```rust
fn convert_back(self: &Self, value: Option<&BoxedValue>, target_type: ValueType, parameter: Option<&BoxedValue>, culture: &CultureInfo) -> Result<Option<BoxedValue>, BindingError>
```

Converts a value on its way from the binding target to the source.

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

## Trait implementations

- [`IValueConverter`](/docs/0.5.0/api/ferroui-base/data/converters/trait-ivalueconverter/)

## Availability

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