Kukks / Blazor.Ionic

Integration of Ionic5 into Blazor
MIT License
39 stars 8 forks source link

2-way @bind-Value on bool IonToggle and IonCheckbox don't compile #2

Closed DanGould closed 3 years ago

DanGould commented 3 years ago

Maybe this is because Value is set to type bool? instead of bool

error is: /Users/dan/f/chaincase/app/Chaincase.UI/obj/Debug/netstandard2.1/Razor/Components/SelectableCoin.razor.g.cs(282,282): Error CS1503: Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to 'Microsoft.AspNetCore.Components.EventCallback' (CS1503) (Chaincase.UI)

Kukks commented 3 years ago

Yes, there is an example of ion toggle in the dark mode preferences page in chaincase. It is a nullable bool and the type must match for the event callback to match.

The reasoning behind it is that a checkbox can have 3 states: checked, unchecked and indeterminate

On Thu, 24 Dec 2020, 20:41 Dan Gould, notifications@github.com wrote:

Maybe this is because Value is set to type bool? instead of bool

error is: /Users/dan/f/chaincase/app/Chaincase.UI/obj/Debug/netstandard2.1/Razor/Components/SelectableCoin.razor.g.cs(282,282): Error CS1503: Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to 'Microsoft.AspNetCore.Components.EventCallback' (CS1503) (Chaincase.UI)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kukks/Blazor.Ionic/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN357RL6ECULFTUDKSGXQTSWOKPBANCNFSM4VIPO2ZA .

DanGould commented 3 years ago

This issue remains. I get that there's a way to 2-way bind but @bind-Value doesn't work. ion-checkbox's value attribute and checked attibutes are type bool in javascript. indeterminate is another field entirely. I'm not telling you anything new there.

Kukks commented 3 years ago

You're right. I was overthinking this since I was reading the Ionic source instead of the docs which had the value marked as a nullable type. IonToggle and IonCheckbox will now use a bool instead of bool? in the 1.0.7 release