Table of Contents

Class BooleanToValueConverter<TValue>

Namespace
CarinaStudio.Data.Converters
Assembly
CarinaStudio.AppBase.Avalonia.dll

Avalonia.Data.Converters.IValueConverter to convert from bool to specific value type.

public class BooleanToValueConverter<TValue> : IValueConverter

Type Parameters

TValue
Inheritance
BooleanToValueConverter<TValue>
Implements
IValueConverter
Inherited Members
Extension Methods

Constructors

BooleanToValueConverter(TValue, TValue, Func<TValue, TValue, bool>?)

Initialize new BooleanToValueConverter<TValue> instance.

public BooleanToValueConverter(TValue trueValue, TValue falseValue, Func<TValue, TValue, bool>? equalityChecker = null)

Parameters

trueValue TValue

Value converted from True.

falseValue TValue

Value converted from False.

equalityChecker Func<TValue, TValue, bool>

Function to check equality of values.

Properties

FalseValue

Get value converted from False.

public TValue FalseValue { get; }

Property Value

TValue

TrueValue

Get value converted from True.

public TValue TrueValue { get; }

Property Value

TValue

Methods

Convert(object?, Type, object?, CultureInfo)

Converts a value.

public virtual object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)

Parameters

value object

The value to convert.

targetType Type

The type of the target.

parameter object

A user-defined parameter.

culture CultureInfo

The culture to use.

Returns

object

The converted value.

Remarks

This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.

ConvertBack(object?, Type, object?, CultureInfo)

Converts a value.

public virtual object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)

Parameters

value object

The value to convert.

targetType Type

The type of the target.

parameter object

A user-defined parameter.

culture CultureInfo

The culture to use.

Returns

object

The converted value.

Remarks

This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.