Method ConvertBack
ConvertBack(object, Type[], object, CultureInfo)
Convert back a value. Called when moving a value from target to sources. This should implement the inverse of Convert.
object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
Parameters
valueobjectvalue, as produced by target
targetTypesType[]Array of target types; array length indicates the number and types of values suggested for Convert to return.
parameterobjectconverter parameter
cultureCultureInfoculture information
Returns
- object[]
Array of converted back values. If there are more return values than source bindings, the excess portion of return values will be ignored. If there are more source bindings than return values, the remaining source bindings will not have any value set to them.
Types of return values are not verified against targetTypes; the values will be set to source bindings directly.
Binding.DoNothing may be returned in position i to indicate that no value should be set on the source binding at index i.
System.Windows.DependencyProperty.UnsetValue may be returned in position i to indicate that the converter is unable to provide a value to the source binding at index i, and no value will be set to it.
ConvertBack may return null to indicate that the conversion could not be performed at all, or that the backward conversion direction is not supported by the converter.
Remarks
The data binding engine does not catch exceptions thrown by a user-supplied converter. Thus any exception thrown by ConvertBack, or thrown by methods it calls and not caught by the ConvertBack, will be treated as a runtime error (i.e. a crash). ConvertBack should handle anticipated problems by returning null.