.NET MAUI Converters
.NET Multi-platform App UI (.NET MAUI) data bindings usually transfer data from a source property to a target property, and in some cases from the target property to the source property. This transfer is straightforward when the source and target properties are of the same type, or when one type can be converted to the other type through an implicit conversion. When that is not the case, a type conversion must take place.
For further information on Converters please refer to the .NET MAUI documentation.
.NET MAUI Community Toolkit Converters
The .NET MAUI Community Toolkit provides a collection of pre-built, reusable converters to make developers lives easier. Here are the converters provided by the toolkit:
Converter | Description |
---|---|
BoolToObjectConverter |
The BoolToObjectConverter is a converter that allows users to convert a bool value binding to a specific object. |
ByteArrayToImageSourceConverter |
The ByteArrayToImageSourceConverter is a converter that allows the user to convert an incoming value from a byte array and returns an ImageSource . |
ColorToBlackOrWhiteConverter |
The ColorToBlackOrWhiteConverter is a one-way converter that allows users to convert an incoming Color to a monochrome value of either Colors.Black or Colors.White . |
ColorToByteAlphaConverter |
The ColorToByteAlphaConverter is a one-way converter that allows users to convert an incoming Color to the alpha component as a value between 0 and 255. |
ColorToByteBlueConverter |
The ColorToByteBlueConverter is a one-way converter that allows users to convert an incoming Color to the blue component as a value between 0 and 255. |
ColorToByteGreenConverter |
The ColorToByteGreenConverter is a one-way converter that allows users to convert an incoming Color to the green component as a value between 0 and 255. |
ColorToByteRedConverter |
The ColorToByteRedConverter is a one-way converter that allows users to convert an incoming Color to the red component as a value between 0 and 255. |
ColorToCmykStringConverter |
The ColorToCmykStringConverter is a one-way converter that allows users to convert a Color value binding to its CMYK string equivalent. |
ColorToCmykaStringConverter |
The ColorToCmykaStringConverter is a one-way converter that allows users to convert a Color value binding to its CMYKA string equivalent. |
ColorToColorForTextConverter |
The ColorToColorForTextConverter is a one-way converter that allows users to convert an incoming Color to a monochrome value of either Colors.Black or Colors.White based on whether it is determined as being dark for the human eye. |
ColorToDegreeHueConverter |
The ColorToDegreeHueConverter is a one-way converter that allows users to convert an incoming Color to the hue component as a value between 0 and 360. |
ColorToGrayScaleColorConverter |
The ColorToGrayScaleColorConverter is a one-way converter that allows users to convert an incoming Color to a grayscale Color . |
ColorToHexRgbStringConverter |
The ColorToHexRgbStringConverter is a converter that allows users to convert a Color value binding to its RGB hexadecimal string equivalent. |
ColorToHexRgbaStringConverter |
The ColorToHexRgbaStringConverter is a converter that allows users to convert a Color value binding to its RGBA hexadecimal string equivalent. |
ColorToHslStringConverter |
The ColorToHslStringConverter is a one-way converter that allows users to convert a Color value binding to its HSL string equivalent. |
ColorToHslaStringConverter |
The ColorToHslaStringConverter is a one-way converter that allows users to convert a Color value binding to its HSLA string equivalent. |
ColorToInverseColorConverter |
The ColorToInverseColorConverter is a one-way converter that allows users to convert an incoming Color to its inverse. |
ColorToPercentBlackKeyConverter |
The ColorToPercentBlackKeyConverter is a one-way converter that allows users to convert an incoming Color to the key component as a value between 0 and 1. |
ColorToPercentCyanConverter |
The ColorToPercentCyanConverter is a one-way converter that allows users to convert an incoming Color to the cyan component as a value between 0 and 1. |
ColorToPercentMagentaConverter |
The ColorToPercentMagentaConverter is a one-way converter that allows users to convert an incoming Color to the magenta component as a value between 0 and 1. |
ColorToPercentYellowConverter |
The ColorToPercentYellowConverter is a one-way converter that allows users to convert an incoming Color to the yellow component as a value between 0 and 1. |
ColorToRgbStringConverter |
The ColorToRgbStringConverter is a converter that allows users to convert a Color value binding to its RGB string equivalent. |
ColorToRgbaStringConverter |
The ColorToRgbaStringConverter is a one-way converter that allows users to convert a Color value binding to its RGBA string equivalent. |
CompareConverter |
The CompareConverter is a one-way converter that take an incoming value implementing IComparable , compares to a specified value, and returns the comparison result. |
DateTimeOffsetConverter |
The DateTimeOffsetConverter is a converter that allows users to convert a DateTimeOffset to a DateTime |
DoubleToIntConverter |
The DoubleToIntConverter is a converter that allows users to convert an incoming double value to an int and vice-versa. Optionally the user can provide a multiplier to the conversion through the Ratio property. |
EnumToBoolConverter |
The EnumToBoolConverter is a one-way converter that allows you to convert an Enum to a corresponding bool based on whether it is equal to a set of supplied enum values. It is useful when binding a collection of values representing an enumeration type to a boolean control property like the IsVisible property. |
EnumToIntConverter |
The EnumToIntConverter is a converter that allows you to convert a standard Enum (extending int) to its underlying primitive int type. It is useful when binding a collection of values representing an enumeration type with default numbering to a control such as a Picker . |
ImageResourceConverter |
The ImageResourceConverter is a converter that converts embedded image resource ID to its ImageSource. |
IndexToArrayItemConverter |
The IndexToArrayItemConverter is a converter that allows users to convert an int value binding to an item in an array. The int value being data bound represents the indexer used to access the array. The array is passed in through the ConverterParameter . |
IntToBoolConverter |
The IntToBoolConverter is a converter that allows users to convert an incoming int value to a bool and vice-versa. |
InvertedBoolConverter |
The InvertedBoolConverter is a converter that allows users to convert a bool to its inverse - true becomes false and vice-versa. |
IsEqualConverter |
The IsEqualConverter is a one-way converter that returns a bool indicating whether the binding value is equal to another specified value. |
IsInRangeConverter |
The IsInRangeConverter is a one-way converter that takes an incoming value implementing IComparable , and a minimum and maximum value, and returns the result of the value being between the minimum and maximum values. |
IsListNotNullOrEmptyConverter |
The IsListNotNullOrEmptyConverter is a one-way converter that converts IEnumerable to a bool value. |
IsListNullOrEmptyConverter |
The IsListNullOrEmptyConverter is a one-way converter that converts IEnumerable to a bool value. |
IsNotEqualConverter |
The IsNotEqualConverter is a one-way converter that returns a bool indicating whether the binding value is not equal to another specified value. |
IsNullConverter |
The IsNullConverter is a converter that allows users to convert an incoming binding to a bool value. This value represents if the incoming binding value is null. |
IsNotNullConverter |
The IsNotNullConverter is a converter that allows users to convert an incoming binding to a bool value. This value represents if the incoming binding value is not null. |
IsStringNotNullOrEmptyConverter |
The IsStringNotNullOrEmptyConverter is a one-way converter that returns a bool indicating whether the binding value is not null and not an string.Empty . |
IsStringNotNullOrWhiteSpaceConverter |
The IsStringNotNullOrWhiteSpaceConverter is a one-way converter that returns a bool indicating whether the binding value is not null, not an string.Empty and does not contain whitespace characters only. |
IsStringNullOrEmptyConverter |
The IsStringNullOrEmptyConverter is a one-way converter that returns a bool indicating whether the binding value is null or string.Empty . |
IsStringNullOrWhiteSpaceConverter |
The IsStringNullOrWhiteSpaceConverter is a one-way converter that returns a bool indicating whether the binding value is null, string.Empty or contains whitespace characters only. |
ItemTappedEventArgsConverter |
The ItemTappedEventArgsConverter is a converter that allows users to extract the Item value from an ItemTappedEventArgs object. It can subsequently be used in combination with EventToCommandBehavior. |
ListToStringConverter |
The ListToStringConverter is a one-way converter that returns a concatenation of the members of a collection, using the specified separator between each member. |
MathExpressionConverter |
The MathExpressionConverter is a converter that allows users to perform various math operations. |
MultiConverter |
The MultiConverter converts an incoming value using all of the incoming converters in sequence. |
MultiMathExpressionConverter |
The MultiMathExpressionConverter is a converter that allows users to perform various math operations with multiple values through using a MultiBinding . |
SelectedItemEventArgsConverter |
The SelectedItemEventArgsConverter is a converter that allows users to extract the Item value from an SelectedItemEventArgs object. It can subsequently be used in combination with EventToCommandBehavior. |
StateToBoolConverter |
The StateToBoolConverter is a one-way converter that returns a boolean result based on whether the supplied value is of a specific LayoutState . |
StringToListConverter |
The StringToListConverter is a one-way converter that returns a set of substrings by splitting the input string based on one or more separators. |
TextCaseConverter |
The TextCaseConverter is a one-way converter that allows users to convert the casing of an incoming string type binding. The Type property is used to define what kind of casing will be applied to the string. |
VariableMultiValueConverter |
The VariableMultiValueConverter is a converter that allows users to convert bool values via a MultiBinding to a single bool . |
.NET MAUI Community Toolkit