Table of Contents

Class BooleanConverter

Namespace
Acuit.Pinpoint.Windows
Assembly
Acuit.Pinpoint.Windows.dll

A general-purpose value converter that converts any object to a booltrue or false.

[ValueConversion(typeof(object), typeof(bool))]
public class BooleanConverter : IValueConverter
Inheritance
BooleanConverter
Implements
Inherited Members

Remarks

If the source value is of type bool, then the value is passed through unchanged. If the source value is of type string, then the value is true if it is not an empty string. Otherwise, the value is true if the source is not null. NOTE: Does NOT convert strings like "True" and "False"; any non-empty string will yield true.

Properties

IsReversed

Gets or sets whether to reverse (i.e., apply a Boolean NOT to) the return value.

public bool IsReversed { get; set; }

Property Value

bool

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.

ConvertObjectToBoolean(object)

Converts any object to a bool.

public static bool ConvertObjectToBoolean(object value)

Parameters

value object

The object to convert.

Returns

bool

The object's boolean value (see the class remarks).

Remarks

NOTE: Does NOT convert strings like "True" and "False"; any non-empty string will yield true.