I\'m not talking about an event handler for this, but rather a simple If Statement
checking if the CheckBox
has been checked. So far I have:
Multiple answers already but here is another alternative
if (chkRevLoop.IsChecked.GetValueOrDefault()) {}
From MSDN
A bool?
can be true, false or null, while bool
can only be true or false. ?
makes a type "nullable" and adds null as a possibility when it normally isn't, so you can probably just use
if ((bool)chkRevLoop.IsChecked == true){}
or
if (chkRevLoop.IsChecked == (bool?)true){}
to make it match up and work. The second is probably better, since I don't know what would happen in the cast if IsChecked is null