WPF Checkbox check IsChecked

后端 未结 8 827
别跟我提以往
别跟我提以往 2020-12-08 10:25

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:

<
8条回答
  •  -上瘾入骨i
    2020-12-08 10:51

    You should use Nullable object. Because IsChecked property can be assigned to three different value: Null, true and false

    Nullable isChecked  = new Nullable(); 
    isChecked = chkRevLoop.IsChecked; 
    
    if (isChecked.HasValue && isChecked.Value)
    {
    
    
    }
    

提交回复
热议问题