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
trueValueTValueValue converted from True.
falseValueTValueValue converted from False.
equalityCheckerFunc<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
valueobjectThe value to convert.
targetTypeTypeThe type of the target.
parameterobjectA user-defined parameter.
cultureCultureInfoThe 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
valueobjectThe value to convert.
targetTypeTypeThe type of the target.
parameterobjectA user-defined parameter.
cultureCultureInfoThe 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.