Class GenericConverter<TInput, TOutput, TParameter>
A helper base class for value converters.
public abstract class GenericConverter<TInput, TOutput, TParameter> : ValidationRule, IValueConverter
Type Parameters
TInput
The type of the binding source.
TOutput
The type of the binding target.
TParameter
The type of the converter parameter.
- Inheritance
-
GenericConverter<TInput, TOutput, TParameter>
- Implements
- Derived
- Inherited Members
Methods
Convert(object, Type, object, CultureInfo)
Converts a value.
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
value
objectThe value produced by the binding source.
targetType
TypeThe type of the binding target property.
parameter
objectThe converter parameter to use.
culture
CultureInfoThe culture to use in the converter.
Returns
- object
A converted value. If the method returns null, the valid null value is used.
Convert(TInput, TParameter, CultureInfo)
When overridden in a derived class, converts a value.
public abstract TOutput Convert(TInput value, TParameter parameter, CultureInfo culture)
Parameters
value
TInputThe value produced by the binding source.
parameter
TParameterThe converter parameter to use.
culture
CultureInfoThe culture to use in the converter.
Returns
- TOutput
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
objectThe value that is produced by the binding target.
targetType
TypeThe type to convert to.
parameter
objectThe converter parameter to use.
culture
CultureInfoThe culture to use in the converter.
Returns
- object
A converted value. If the method returns null, the valid null value is used.
ConvertBack(TOutput, TParameter, CultureInfo)
When overridden in a derived class, converts a value.
public abstract TInput ConvertBack(TOutput value, TParameter parameter, CultureInfo culture)
Parameters
value
TOutputThe value that is produced by the binding target.
parameter
TParameterThe converter parameter to use.
culture
CultureInfoThe culture to use in the converter.
Returns
- TInput
A converted value. If the method returns null, the valid null value is used.
Validate(object, CultureInfo)
Performs validation checks on a value.
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
Parameters
value
objectThe value from the binding target to check.
cultureInfo
CultureInfoThe culture to use in this rule.
Returns
- ValidationResult
A ValidationResult object.