I want a select all checkbox which when checked, checks all other checkboxes and when unchecked, unchecks the others. I have written this code:
private void all_CheckedChanged(object sender, RoutedEventArgs e)
{
if (all.IsChecked == true) //this is working
{
issue.IsChecked = true;
summary.IsChecked = true;
type.IsChecked = true;
status.IsChecked = true;
label.IsChecked = true;
components.IsChecked = true;
empty.IsChecked = true;
reporter.IsChecked = true;
requester.IsChecked = true;
team.IsChecked = true;
assignee.IsChecked = true;
}
else if (all.IsChecked == false) //this is not doing anything
{
issue.IsChecked = false;
summary.IsChecked = false;
type.IsChecked = false;
//same for other checkboxes
}
}
when I debug it I see that the event takes places when I check the checkbox but nothing happens when I uncheck it. Someone, please suggest me how to do this in case I am doing something wrong. I am quite new to c# so might have missed something obvious.
Aucun commentaire:
Enregistrer un commentaire