New to Telerik UI for .NET MAUIStart a free 30-day trial

Converts boolean values to specified objects based on true/false conditions.

Definition

Namespace:Telerik.Maui.Controls

Assembly:Telerik.Maui.Controls.dll

Syntax:

C#
public class BoolToValueConverter : IValueConverter

Inheritance: objectBoolToValueConverter

Implements: IValueConverter

Constructors

C#
public BoolToValueConverter()

Properties

Gets or sets the value to return when the boolean input is false.

C#
public object FalseValue { get; set; }
Property Value:

The value for false condition.

Gets or sets the value to return when the boolean input is true.

C#
public object TrueValue { get; set; }
Property Value:

The value for true condition.

Methods

Converts a boolean value to the corresponding TrueValue or FalseValue.

C#
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

The boolean value to convert.

targetTypeType

The type of the binding target property.

parameterobject

The converter parameter to use.

cultureCultureInfo

The culture to use in the converter.

Returns:

object

TrueValue if the input is true, otherwise FalseValue.

Converts a value back to a boolean by comparing it with TrueValue.

C#
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

The value to convert back.

targetTypeType

The type of the binding target property.

parameterobject

The converter parameter to use.

cultureCultureInfo

The culture to use in the converter.

Returns:

object

True if the value equals TrueValue, otherwise false.