BindableProps
BindableProps copied to clipboard
nullable `bool?` code generator produces BindableProperty `bool`
Describe the bug
A nullable boolean bool? field is source-generated as a bool BindableProperty
To Reproduce
[BindableProp(DefaultBindingMode = (int)BindingMode.OneWay)]
private bool? isToggled;
Generated Code
public static readonly BindableProperty IsToggledProperty = BindableProperty.Create(
nameof(IsToggled),
typeof(bool),
typeof(MyCustomControl),
default,
(BindingMode)(int)BindingMode.OneWay,
null,
(bindable, oldValue, newValue) =>
((MyCustomControl)bindable).IsToggled = (bool?)newValue,
null,
null,
null
);
Expected behavior
public static readonly BindableProperty IsToggledProperty = BindableProperty.Create(
nameof(IsToggled),
typeof(bool?), //<----
typeof(MyCustomControl),
default,
(BindingMode)(int)BindingMode.OneWay,
null,
(bindable, oldValue, newValue) =>
((MyCustomControl)bindable).IsToggled = (bool?)newValue,
null,
null,
null
);
Your environment: .net 9.0 MAUI [email protected]
Hi @hifiguitarguy
Please update to version 1.5.1-beta and try. Let me know if it works. Thanks.