Table of Contents

Class BooleanConverter

Namespace
Tudormobile.Wpf.Converters
Assembly
Tudormobile.WpfControls.dll

Provides a type converter to convert Boolean values to and from other representations. Values to convert to are provided as properties on the converter.

public class BooleanConverter : IValueConverter
Inheritance
BooleanConverter
Implements
Inherited Members

Remarks

This class is typically used to convert Boolean values to and from strings or other data types in scenarios such as data binding, serialization, or user interface interactions. If TrueValue or FalseValue are not set, the converter will return an appropriate guess based on the target type.

Properties

FalseValue

Gets or sets the value that represents a logical "false" value when converting.

public object? FalseValue { get; set; }

Property Value

object

IsInverted

Gets or sets a value indicating whether the operation is inverted. (True becomes False and vice versa).

public bool IsInverted { get; set; }

Property Value

bool

TrueValue

Gets or sets the value that represents true value when converting.

public object? TrueValue { get; set; }

Property Value

object

Methods

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

Converts a value.

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

Parameters

value object

The value produced by the binding source.

targetType Type

The type of the binding target property.

parameter object

The converter parameter to use.

culture CultureInfo

The culture to use in the converter.

Returns

object

A converted value. If the method returns null, the valid null value is used.

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

Converts a value.

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

Parameters

value object

The value that is produced by the binding target.

targetType Type

The type to convert to.

parameter object

The converter parameter to use.

culture CultureInfo

The culture to use in the converter.

Returns

object

A converted value. If the method returns null, the valid null value is used.