Class BooleanConverter
- Namespace
- Tudormobile.OpenTrivia.UI.Converters
- Assembly
- Tudormobile.OpenTrivia.UI.dll
Provides a value converter that maps Boolean values to customizable representations for various target types, supporting both forward and reverse conversion.
public class BooleanConverter : IValueConverter
- Inheritance
-
BooleanConverter
- Implements
- Inherited Members
Remarks
The BooleanConverter enables conversion between Boolean values and other types, such as strings, integers, and visibility states, with the ability to specify custom values for true and false. The conversion direction can be inverted by setting the IsInverted property, which swaps the true and false values during conversion. If TrueValue or FalseValue is not set, default representations are used based on the target type. This converter is commonly used in data binding scenarios to adapt Boolean values for UI elements or other data types.
Constructors
BooleanConverter()
public BooleanConverter()
Properties
FalseValue
Gets or sets the value that represents a logical "false" value when converting.
public object? FalseValue { get; set; }
Property Value
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
TrueValue
Gets or sets the value that represents true value when converting.
public object? TrueValue { get; set; }
Property Value
Methods
Convert(object, Type, object?, CultureInfo?)
public object? Convert(object value, Type targetType, object? parameter, CultureInfo? culture)
Parameters
valueobjecttargetTypeTypeparameterobjectcultureCultureInfo
Returns
ConvertBack(object, Type, object?, CultureInfo?)
public object ConvertBack(object value, Type targetType, object? parameter, CultureInfo? culture)
Parameters
valueobjecttargetTypeTypeparameterobjectcultureCultureInfo