Am building a new App in .Net Maui using VS 2022 Preview. I am using CommunityToolkit.Mvvm
I have an entry field. When this field loses focus, I want to trigger a command.
My xaml is :
<Entry Margin="10,0,10,0"
MaxLength="20"
IsEnabled="{Binding IsNotBusy}"
PlaceholderColor="Red"
>
<Entry.Behaviors>
<toolkit:EventToCommandBehavior EventName="Unfocused" Command="{Binding GetDetailsCommand}"></toolkit:EventToCommandBehavior>
</Entry.Behaviors>
Everything compiles and runs. But when the entry field loses focus I get a System.InvalidCastException.
What am I doing wrong?
Could this be because I am using the sourcegenerators in the mvvm toolkit?
[ICommand]
public async void GetDetails()
Kindly help.
Edit : I noticed that source generator generates IAsyncRelayCommand and not an ICommand object. That is what prompted me to ask the above question.