RadioButton.Checked Error: Control.Checked cannot appear on the left hand side of += or -=

前端 未结 3 1063
北荒
北荒 2021-01-06 17:21

I am having the strangest problem, and I have to be missing something.

Here is my code that is causing the error.

if (radLot.Checked == true)
{
    S         


        
3条回答
  •  萌比男神i
    2021-01-06 18:18

    This is indeed true - just hit this problem myself converting from Winforms to WPF.

    In WPF using:

    if (radiobutton1.IsChecked == true)
    

    works

    BUT

    if (radiobutton1.IsChecked)
    

    Does not.

    However in WinForms

    if (radiobutton1.Checked)
    

    works but does not in WPF.

提交回复
热议问题