Skip to content

Binding null conditional operator doesnt support Nullable<T> #18720

Description

@danwalmsley

Describe the bug

{Binding MyModel?.MyProperty} doesnt compile when MyModel is a valuetype.

To Reproduce

so for example I have a property MyStruct? MyModel on my ViewModel
and use {Binding MyModel?.MyProperty} it doesnt compile

Error AVLN2000 Avalonia: Unable to resolve property or method of name 'MyProperty' on type 'System.Nullable`1'. Line 11, position

I can make it compile with {Binding MyModel.Value.MyProperty} but then obviously we loose the null checking. Could it be possible to make it work with nullable ?

Expected behavior

This should compile without issue.

Avalonia version

11.3.x

OS

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions