Class BoolToDoubleConverter

Converts a bool to one of two double values. Used in AXAML to bind IsBipolar → ProgressBar Minimum.

Inheritance
BoolToDoubleConverter
Implements
IValueConverter
Namespace: MOSAIC.Converters
Assembly: MOSAIC.dll
Syntax
public class BoolToDoubleConverter : IValueConverter
Examples
<converters:BoolToDoubleConverter x:Key="BipolarToMin" TrueValue="-1" FalseValue="0"/>
<ProgressBar Minimum="{Binding IsBipolar, Converter={StaticResource BipolarToMin}}"/>

Properties

FalseValue

Value returned when the input is false.

Declaration
public double FalseValue { get; set; }
Property Value
Type Description
double

TrueValue

Value returned when the input is true.

Declaration
public double TrueValue { get; set; }
Property Value
Type Description
double

Methods

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

Converts a value.

Declaration
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
Type Name Description
object value

The value to convert.

Type targetType

The type of the target.

object parameter

A user-defined parameter.

CultureInfo culture

The culture to use.

Returns
Type Description
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.

Declaration
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
Type Name Description
object value

The value to convert.

Type targetType

The type of the target.

object parameter

A user-defined parameter.

CultureInfo culture

The culture to use.

Returns
Type Description
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.

Implements

Avalonia.Data.Converters.IValueConverter

Search documentation

Start typing to search the documentation.