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
Is your feature request related to a problem? Please describe.
When working with bindings, if the binding system detects that there is a null value somewhere along the binding path, it logs a warning:
<TextBlockText="{Binding Foo.Bar}"/>
[Binding]An error occurred binding 'Text' to 'Foo.Bar' at 'Foo': 'Value is null.' (TextBlock #14000148)
Often this warning is useful for diagnostic purposes, but at other times it is expected that the value of Foo may be null, which which case the warning is noise.
Describe the solution you'd like
The proposal is to add support for a null-conditional operator, similar to that of C# to the Avalonia binding system. The null-conditional operator would take the form ?.:
<TextBlockText="{Binding Foo?.Bar}"/>
When a binding path node is followed by the null-conditional operator, and the result of reading the value from the property specified by the node is null, no warning will be logged.
Describe alternatives you've considered
C# also has a null-conditional element accessor (?[]). This proposal does not suggest to add this operator immediately as it is my opinion that the operator would have much less utility than ?.. If there is seen to be need for it, then it can be added in future.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When working with bindings, if the binding system detects that there is a
null
value somewhere along the binding path, it logs a warning:Often this warning is useful for diagnostic purposes, but at other times it is expected that the value of
Foo
may be null, which which case the warning is noise.Describe the solution you'd like
The proposal is to add support for a null-conditional operator, similar to that of C# to the Avalonia binding system. The null-conditional operator would take the form
?.
:When a binding path node is followed by the null-conditional operator, and the result of reading the value from the property specified by the node is null, no warning will be logged.
Describe alternatives you've considered
C# also has a null-conditional element accessor (
?[]
). This proposal does not suggest to add this operator immediately as it is my opinion that the operator would have much less utility than?.
. If there is seen to be need for it, then it can be added in future.Additional context
No response
The text was updated successfully, but these errors were encountered: