I'm new to wpf and I decided to make a simple To-Do app. I list the tasks in a listview, the number of tasks varies, so I created a list then defined the checkbox list as the item source of the listview. My problem is that I can't trigger an event when a checkbox is checked. I tried this but it's not efficient and the tasks don't disappear until I move my mouse:
private void lw_liste_MouseMove(object sender, MouseEventArgs e)
{
for (int i = 0; i < tasks.Count; i++)
{
if((bool)tasks.ElementAt(i).IsChecked)
{
tasks.RemoveAt(i);
lw_liste.Items.Refresh();
}
}
}
how can I trigger an event when a checkbox in a list is checked so I can remove them from the list?