WPF Checkbox check IsChecked

后端 未结 8 837
别跟我提以往
别跟我提以往 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:38

    You have to do this conversion from bool? to bool, to make it work:

    if((bool)(chkRevLoop.IsChecked)){}
    

    Since it is already a bool condition you need not to put true false because if it is true then only it will come inside this if condition else not. so, no need to even put chkRevLoop.IsChecked == true here, you are by default asking ==true by puttin IsChecked

提交回复
热议问题