Checked
is an event (that’s why an exception is being thrown when your code looks for an handler subscription, MSDN reference), IsChecked
is a Boolean
and it’s probably the property you are looking for (MSDN reference). Your code should look like this:
private void button_Click(object sender, RoutedEventArgs e)
{
if ((bool)checkBox1.IsChecked)
Console.Write("Checked");
}
5
solved if(checkbox.Checked){} issues [duplicate]