Class BoolToStringConverter
Implementation of IValueConverter that converts a Boolean to a custom string representation e.g., convert true to "Enabled".
Implements
Inherited Members
Namespace: BionicCode.Utilities.Net
Assembly: BionicCode.Utilities.Net.Wpf.dll
Syntax
[ValueConversion(typeof(bool), typeof(string))]
public class BoolToStringConverter : DependencyObject, IValueConverter
Examples
<ToggleButton IsChecked="{Binding IsEnabled}">
<ToggleButton.Content>
<Binding Path="IsEnabled">
<Binding.Converter>
<BoolToStringConverter TrueValue="On" FalseValue="{Binding DisabledText}" NullValue="Undefined" />
</Binding.Converter>
</Binding>
</ToggleButton.Content>
</ToggleButton>
Fields
| Improve this Doc View SourceFalseValueProperty
The DependencyProperty of the FalseValue property.
Declaration
public static readonly DependencyProperty FalseValueProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
NullValueProperty
The DependencyProperty of the NullValue property.
Declaration
public static readonly DependencyProperty NullValueProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
TrueValueProperty
The DependencyProperty of the TrueValue property.
Declaration
public static readonly DependencyProperty TrueValueProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
| Improve this Doc View SourceFalseValue
The value to show in case the converter input evaluates to false.
Declaration
public string FalseValue { get; set; }
Property Value
| Type | Description |
|---|---|
| String | A string representation of Boolean that evaluates to |
NullValue
The value to show in case the converter input evaluates to true.
Declaration
public string NullValue { get; set; }
Property Value
| Type | Description |
|---|---|
| String | A string representation of Nullable that evaluates to |
TrueValue
The value to show in case the converter input evaluates to true.
Declaration
public string TrueValue { get; set; }
Property Value
| Type | Description |
|---|---|
| String | A string representation of Boolean that evaluates to |
Methods
| Improve this Doc View SourceConvert(Object, Type, Object, CultureInfo)
Declaration
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value | |
| Type | targetType | |
| Object | parameter | |
| CultureInfo | culture |
Returns
| Type | Description |
|---|---|
| Object |
ConvertBack(Object, Type, Object, CultureInfo)
Declaration
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | value | |
| Type | targetType | |
| Object | parameter | |
| CultureInfo | culture |
Returns
| Type | Description |
|---|---|
| Object |