I have four radio buttons where one is called rb_four, and when this is checked, I want something to happen. When I type the following:
if (rb_fourp.Checked)
{
}
I get an error saying: The event ToggleButton.Checked can only appear on the left hand side of += or -=. What am I doing wrong here?
For info, this is the xaml code for the radio button:
<RadioButton Name="rb_fourp" Width="150" Height="150" Checked="rb_fourp_Checked">
Checked is the name of the event that is raised when clicking the radio button.
The IsChecked
property would be the value you would want to check
if(rb_four.IsChecked){ do some code }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.