Converters

In MVVM, there will be some point where you will need to use converters. Most of these converters are used in any project, so we have decided to add them the Catel. Below is a list of converters and a short description what they are used for.

Note that the behavior of most converters can be inverted by using the ConverterParameter

NameDescription
BooleanToCollapsingVisibilityConverterConvert from bool to Visibility and back.
BooleanToHidingVisibilityConverterConvert from bool to Visibility and back.
BooleanToGrayscaleConverterConverts a boolean to a grayscale saturation value. If the input is false, this converter will return 0, otherwise 1.
BooleanToOppositeBooleanConverterConvert a boolean to it's inverted value.
BooleanToTextConverterConverts a boolean value to text, for example "yes" and "no", or "x" and " ".
ColorToBrushConverterConverts a color value to a brush and vice versa.
ContainsItemsConverterConvert the count of a collection to true or false, depending on whether the collection contains items.
EmptyStringToCollapsingVisibilityConverterConverts a string to Visibility. If the string is empty, it will return Visibility.Collapsed.
EmptyStringToHidingVisibilityConverterConverts a string to Visibility. If the string is empty, it will return Visibility.Hidden.
IntToStringConverterConverts integer to string and back.
IsSelectedConverterConverts a selected value to either true of false.
IsSelectedValueConverterConverts a selected value to either true of false.
MethodToValueConverterConverts the result of a method to a value. This makes it possible to bind to a method.
MultiplyConverterCalculates the product of given value and factor in parameter.
NullableValueConverterConverts a value to a representive value for nullable.
ReferenceToBooleanConverterConverts a reference to a boolean. If the reference is null, it will return false.
ReferenceToCollapsingVisibilityConverterConverts a reference to Visibility. If the reference is null, it will return Visibility.Collapsed.
ReferenceToHidingVisibilityConverterConverts a reference to Visibility. If the reference is null, it will return Visibility.Hidden.
ShortDateFormattingConverterConverts a date to a short date and back.
StringToIntConverterConverts string to an integer and back.