Converters
A converter sits between a binding source and target to format, coerce, or write back values.Define converters
Use in bindings
Converterreferences aConverter.Namein the current XMLConverterParameteris optional and overrides the converter’sFormatMode:OneWay(default) /TwoWay/OneWayToSource- Existing
{Data.foo}and{Inputs.foo}shorthand remains valid
MultiBinding
Paths is separated by |. Script converters receive a values array. Built-in converters use the first value, except Join which joins all values.
Built-in types
Script converters
value: single inputvalues: array of inputsparameter:ConverterParametertargetType: target type stringculture: current localescope: current binding scope
Convert is required; ConvertBack is optional. A script error returns an empty value and does not break rendering.
Script converters in remote widgets are executable content and participate in remote-update confirmation. Do not perform network I/O or heavy work in a converter.
ConvertBack
Two-way input controls (currentlyTextBox and CheckBox) call ConvertBack on change. If the converter has no ConvertBack or returns undefined, the write-back is ignored.
Limits
- Converters run synchronously; do not perform I/O or network work in
Convert Formathandles numbers; useDateTimefor datesBoolToVisibilityreturns the stringsVisible/Collapsed