'Checkbox To Do list update SQLite database Xamarin / .net Maui

I am trying to make a checkbox work with SQLite when checking it done it will update the Done property in the model for tasks. The checkbox is in a collectionview with itemsource set to a list of tasks. Using sqlite-net-pcl

XAML Element:

<CheckBox x:Name="CheckBox_Done" IsChecked="{Binding Done}" CheckedChanged="CheckedDone"  />

C# code behind:

private async void CheckedDone(object sender, CheckedChangedEventArgs e)
    {
        var temp = sender as Tasks;
        temp.Done = !temp.Done;
        await App.Database.UpdateTask(temp);
    }

My database update function

public Task<int> UpdateTask(Tasks task)
    {
        return db.UpdateAsync(task);
    }

The sender as tasks does not appear to be working, what am I doing wrong here>?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source