You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 1, 2024. It is now read-only.
In order to match a bug fixing coming to the MAUI Toolkit we should aim to solve it here also. The issue in question is: CommunityToolkit/Maui#184
Description
Currently it is not possible to pass in a null value to the BaseConverterOneWay<TFrom, TTo> converter or any implementations of it due to checks within the base class.
Most important details from the discussion/issue:
The TargetNullValue of XAML's Converter for bindings is applied to the result of the converter and not to the value before it goes in to the converter.
Let the BaseConverterOneWay<TFrom, TTo> check for null and fallback to the default value for TFrom instead of throwing an Exception. (Suggested by @pictos )
If we went with a blanket always replace nulls with default then that is a behavioral change but is still probably unlikely to have a big impact. If we added a way to opt-in as @Countryen suggested then it would have even less of an impact.
This would then mean that the actual custom converter's ConvertFrom(TFrom value) is called with default(TFrom) when value is null. We could then add a null check to return something the view can use.