How to set checkbox.isChecked without raising event

One way would be to detach the event handler, set the IsChecked property, and then reattach it.

myCheckbox.Checked -= myCheckbox_Checked;
myCheckbox.IsChecked = true;
myCheckbox.Checked += myCheckbox_Checked;

You could use the Click event instead of Checked and use the state of the checkbox like below:

private void normalCheck_Click(object sender, RoutedEventArgs e)
{
    if (normalCheck.IsChecked ?? false) { normal(); }
}

Then, this event won't be raised by using normalCheck.IsChecked = true;. It will only be raised by a click.

NOTE: The null-coalescing operator (??) is necessary because IsChecked returns a bool? type which could be null.

Tags:

C#

Wpf

Checkbox