Name

RadioButton

Synopsis

This Control provides a means of selecting one of a set of mutually exclusive options. (Compare this with a set of CheckBox objects that may all be selected simultaneously.) All the RadioButton objects within a single container act as a single exclusion group. Therefore, to have several independent groups on the same parent Control, you must place them in different containers. Panel or GroupBox objects will do the job.

You can change the Appearance of the control from the Normal dot with a label to a Button-like style. In the Normal view, the position of the RadioButton relative to the label can be modified with the CheckAlign property.

As with the CheckBox, you can determine whether the item is Checked (although it does not have an equivalent of the CheckBox.CheckState property, as there is no tristate support). You can also enable AutoCheck to ensure that the system automatically checks the selected button and unchecks the others in the group. You can bind to the CheckedChanged event to be notified when the Checked state changes.


public class RadioButton : ButtonBase {

// Public Constructors

   public RadioButton();

// Public Instance Properties

   public Appearance Appearance{set; get; }

   public bool AutoCheck{set; get; }

   public ContentAlignment CheckAlign{set; get; }

   public bool Checked{set; get; }

   public bool TabStop{set; get; }

// overrides Control

   public override ContentAlignment TextAlign{set; get; }

// overrides ButtonBase

                  // Protected Instance Properties ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.