1. Common Properties:
(1) Checked property: used to set or return whether the radio button is selected, the check value is true, and no check value is false.
(2) AutoCheck property: If the AutoCheck property is set to True (the default), all other radio buttons in the group are automatically cleared when the radio button is selected. For the average user, you do not need to change this property to use the default value (TRUE).
(3) Appearance property: Used to get or set the appearance of a radio button control. When it takes a value of Appearance.Button, the radio button looks like a command button: It appears to have been pressed when it is selected. When the value is Appearance.normal, it is the appearance of the default radio button.
(4) Text property: Used to set or return the text displayed within a radio button control, which can also contain an access key, which is preceded with a "&"
The letter of the symbol so that the user can select the control by pressing the ALT key and the access key at the same time.
2. Common events:
(1) Click event: When the radio button is clicked, the Checked property value of the radio button is set to True, and the Click event occurs.
(2) CheckedChanged event: When the Checked property value changes, the CheckedChanged event is triggered.
The RadioButton in WPF may be different from the web, without attributes such as group. Put the same group of RadioButton into a GroupBox or panel when you use them, and they are automatically set, and there are two ways to use them (to determine which one is selected):
The first method:
Copy Code code as follows:
foreach (Control Ctrl-Groupbox1.controls)
{
If (Ctrl is RadioButton)
{
if ((RadioButton) ctrl). Checked)
{
Add the action you need
}
}
}
The second method: Add events to each RadioButton
Copy Code code as follows:
private void radioButton_CheckedChanged (object sender, EventArgs e)
{
RadioButton rb= (RadioButton) sender;
if (RB. Checked)
{
Add the action you need
}
}