WPF Checkbox check IsChecked

c#, if-statement, wpf

Solution

You can use null coalescing operator. This operator returns right-hand operand if the left-hand operand is null. So you can return `false` when the `CheckBox` is in indeterminate state (when the value of `IsChecked` property is set to null):

if (chkRevLoop.IsChecked ?? false)
{

}

Problem

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: ``` if (chkRevLoop.IsChecked == true){} ``` But that raises the error: Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?) Is there a way to do this that I'm missing?

Original source