Class
StringToBoolConverter

Represents an IValueConverter that converts string values to boolean values. Returns true if the string is not null or empty, or if a parameter is provided and contains the string value.

Definition

Namespace:Telerik.Maui.Controls

Assembly:Telerik.Maui.Controls.dll

Syntax:

cs-api-definition
public class StringToBoolConverter : IValueConverter

Inheritance: objectStringToBoolConverter

Implements: IValueConverter

Constructors

StringToBoolConverter()

Declaration

cs-api-definition
public StringToBoolConverter()

Methods

Convert(object, Type, object, CultureInfo)

Converts a string value to a boolean.

Declaration

cs-api-definition
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

Parameters

value

object

The string value to convert.

targetType

Type

The type to convert to (should be bool).

parameter

object

An optional parameter string to check if it contains the value.

culture

CultureInfo

The culture to use for the conversion.

Returns

object

True if the parameter contains the value (case-insensitive), or if parameter is null and value is not null or empty; otherwise, false.

ConvertBack(object, Type, object, CultureInfo)

Converts a boolean value back to a string. This operation is not supported.

Declaration

cs-api-definition
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

Parameters

value

object

The boolean value to convert back.

targetType

Type

The type to convert back to.

parameter

object

An optional parameter (not used).

culture

CultureInfo

The culture to use for the conversion (not used).

Returns

object

This method always throws a NotSupportedException.

Exceptions

NotSupportedException

Always thrown as conversion back from bool to string is not supported.