I can’t find no one online having the same trouble i’m having.
Building a pretty straightforward test app (coming from XF, checking out how MAUI is hanging), I’m coding a to-do. Within CollectionView, I have a “checkbox” (long story):
<mdc:IconButton
...
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:ToDoViewModel}}, Path=FinishTaskCommand, Mode=TwoWay}"
CommandParameter="{Binding .}">
// triggers
</mdc:IconButton>
And that works. Except it only works after I comment any portion of xaml, save, uncomment and save again – triggering a reload.
Before that it simply does not trigger the command:
[RelayCommand]
private void FinishTask(ToDoTask task)
{
if (task == null)
return;
task.FinishedAt = task.FinishedAt == null
? DateTime.Now
: null;
}
My BindingContext on the code-behind is set correctly and I even builder.Services.AddTransient<ToDoViewModel>()
on MauiProgram.cs
. I also did this:
protected override void OnAppearing()
{
base.OnAppearing();
if (BindingContext is ToDoViewModel viewModel)
{
viewModel.AppearingCommand.Execute(null);
}
}
You can guess why. It only works after forcing a hot reload. Also, my good old pal InvalidateLayout()
does not seem to have been brought over to MAUI.
Check it live: https://imgur.com/a/LDURK6W
Thank you.
1