Convert Method
- Namespace
TXTextControl.WPF
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesWPF. dll
Description
Converts a value to a boolean. True is returned, if the specified parameter is the string representation of value.
Syntax
public object Convert(object value, Type targetType, object parameter, CultureInfo culture);Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As ObjectParameters
| Parameter | Description |
|---|---|
| value | The value produced by the binding source. Supported types are: System.Enum, int, int?, bool?, char and char?. |
| targetType | The type of the binding target property. It must be a boolean. |
| parameter | The converter parameter to use. It must be a string. The converter returns true, if this value is the string representation of value. To convert a bool? to a bool, this parameter is not used and can be set to null. |
| culture | The culture to use in the converter. |
Return Value
The converted value, true or false. The method returns DependencyProperty.UnsetValue, if the conversion is not possible.
Examples
The following example uses Convert in a focused Boolean Converter workflow.
var result = booleanConverter.Convert("Approved", typeof(object), "Approved", System.Globalization.CultureInfo.GetCultureInfo("en-US"));
Console.WriteLine($"Convert result: {result}");Dim result = booleanConverter.Convert("Approved", GetType(Object), "Approved", System.Globalization.CultureInfo.GetCultureInfo("en-US"))
Console.WriteLine($"Convert result: {result}")