Accepting User Choices with the RadioButton Control

The RadioButton control works similarly to the CheckBox, differing in that this enables one choice among several alternatives, but it exposes the same properties. The following XAML code declares two RadioButton controls:

<StackPanel>    <RadioButton Name="Radio1" Content="First option"/>    <RadioButton Name="Radio2" Content="Second option"/></StackPanel>

Each instance exposes the IsChecked property and the Checked and Unchecked events. For this, take a look back at the CheckBox discussion. Figure 29.15 shows how the controls look.

Image

FIGURE 29.15 Adding RadioButton ...

Get Visual Basic 2015 Unleashed 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.