Dreamescaper / BlazorBindings.Maui

MAUI Blazor Bindings - Build native and hybrid MAUI apps with Blazor
MIT License
242 stars 16 forks source link

Generator: generate Changed property as nullable if main property is nullable #126

Closed Dreamescaper closed 1 year ago

Dreamescaper commented 1 year ago

Currently it generates them like this:

        [Parameter] public int? SelectedIndex { get; set; }
        [Parameter] public EventCallback<int> SelectedIndexChanged { get; set; }

Because the types do not match, @bind-SelectedIndex is not allowed.

Dreamescaper commented 1 year ago

It turns out that the issue is not because of generator itself, it's because currently all value-type properties are mapped as nullables. While it would be great to change that (which would be a huge breaking change), it's out of scope of generator.

It is still possible to use @bind syntax if it is mapped to a non-nullable property.