Class GenericConverter<TInput, TOutput, TParameter>
A helper base class for value converters.
public abstract class GenericConverter<TInput, TOutput, TParameter> : ValidationRule, IValueConverter
Type Parameters
TInputThe type of the binding source.
TOutputThe type of the binding target.
TParameterThe 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
valueobjectThe value produced by the binding source.
targetTypeTypeThe type of the binding target property.
parameterobjectThe converter parameter to use.
cultureCultureInfoThe 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
valueTInputThe value produced by the binding source.
parameterTParameterThe converter parameter to use.
cultureCultureInfoThe 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
valueobjectThe value that is produced by the binding target.
targetTypeTypeThe type to convert to.
parameterobjectThe converter parameter to use.
cultureCultureInfoThe 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
valueTOutputThe value that is produced by the binding target.
parameterTParameterThe converter parameter to use.
cultureCultureInfoThe 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
valueobjectThe value from the binding target to check.
cultureInfoCultureInfoThe culture to use in this rule.
Returns
- ValidationResult
A ValidationResult object.