WPF Checkbox check IsChecked

后端 未结 8 798
别跟我提以往
别跟我提以往 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条回答
  •  时光说笑
    2020-12-08 10:34

    IsChecked property of CheckBox is Nullable boolean.

    public bool? IsChecked { get; set; }
    

    Create a Nullable boolean and equate it will work for you.

    Code

    bool? NullableBool = chkRevLoop.IsChecked;
    if(NullableBool == true)    {    }
    

提交回复
热议问题